How to include custom term fields in summary view (bis)

Feb 18, 2013 at 9:52 AM
Hello,

I am aware this post is somewhat a duplicate of another post "How to include custom term fields in summary view", but I can't make my code work even though the example is well explained.
I hope that my problem will be an obvious user error, and you will be able to assist me.

So this is how my example is set-up, I have got :
  1. A taxonomy field named "Skills"
  2. An automatically associated ContentType named "Skills Term" with an added custom Field of type Link Field named "Linkto"
  3. A content type named "Work section" which is basically a regular page with in added "Skills" taxonomy
  4. As I want to control how the skills are displayed I have also added Fields.Contrib.TaxonomyField-skills.cshtml
Concretely, what I want to achieve is to redirect users to a custom Wikipedia link instead of the default slug address. I am expecting to get the content of t.ContentItem.Linkto.Url below to contain this wiki link, but it doesn't even find Linkto:
Compiler Error Message: CS1061: 'Orchard.ContentManagement.ContentItem' does not contain a definition for 'Linkto' and no extension method 'Linkto' accepting a first argument of type 'Orchard.ContentManagement.ContentItem' could be found (are you missing a using directive or an assembly reference?)
Fields.Contrib.TaxonomyField-skills.cshtml :
@{
    var terms = (IEnumerable<Contrib.Taxonomies.Models.TermPart>)Model.Terms;
    string name = @Model.ContentField.Name;
}

@if (Model.Terms.Count > 0) {
<div class="taxonomy-field">
    <span class="name">@name.CamelFriendly():</span> 
    @foreach (var term in Model.Terms) {
        if (term.Path == "/") 
        { 
            // parent skill type ( ie: Languages, Databases, ... )
            <h6>@term.Name</h6>
            <p>
            // Children skills ( ie: C, C++, C#; MySQL, SQLServer, ... )
            @(new HtmlString( string.Join(", ", terms
                .Where(t => t.FullPath != term.FullPath && t.FullPath.StartsWith(term.FullPath))
                .Select(t => Html.ItemDisplayLink(t.Name, t.ContentItem.linkto.Url).ToString()).ToArray()) ))
            </p>
        }
    }
</div>
}
And finally, this is my Orchard export [trimmed] file :
<!--Exported from Orchard-->
<Orchard>
  <Recipe>
    <Name>Generated by Orchard.ImportExport</Name>
    <Author>admin</Author>
  </Recipe>
  <Metadata>
    <Types>
      <Taxonomy DisplayName="Taxonomy">
        <TaxonomyPart />
        <CommonPart />
        <TitlePart />
        <AutoroutePart AutorouteSettings.AllowCustomPattern="true" AutorouteSettings.AutomaticAdjustmentOnEdit="false" AutorouteSettings.PatternDefinitions="[{Name:'Title', Pattern: '{Content.Slug}', Description: 'my-taxonomy'}]" AutorouteSettings.DefaultPatternIndex="0" />
      </Taxonomy>
      <TaxonomyMenu Stereotype="Widget" DisplayName="Taxonomy Menu">
        <TaxonomyMenuPart />
        <CommonPart />
        <WidgetPart />
      </TaxonomyMenu>
      <Skills Taxonomy="Skills" ContentTypeSettings.Creatable="False" ContentTypeSettings.Draftable="False" Stereotype="Enumeration" DisplayName="Skills Term">
        <TermPart />
        <TitlePart />
        <AutoroutePart AutorouteSettings.AllowCustomPattern="True" AutorouteSettings.AutomaticAdjustmentOnEdit="False" AutorouteSettings.PatternDefinitions="[{&quot;Name&quot;:&quot;Taxonomy and Title&quot;,&quot;Pattern&quot;:&quot;{Content.Container.Path}/{Content.Slug}&quot;,&quot;Description&quot;:&quot;my-taxonomy/my-term/sub-term&quot;}]" AutorouteSettings.DefaultPatternIndex="0" AutorouteSettings.PerItemConfiguration="False" />
        <CommonPart DateEditorSettings.ShowDateEditor="False" OwnerEditorSettings.ShowOwnerEditor="True" />
        <Skills />
      </Skills>
    </Types>
    <Parts>
      <TaxonomyPart />
      <CommonPart ContentPartSettings.Attachable="True" />
      <TitlePart ContentPartSettings.Attachable="True" />
      <AutoroutePart ContentPartSettings.Attachable="True" />
      <TaxonomyMenuPart />
      <WidgetPart ContentPartSettings.Attachable="True" />
      <TermPart />
      <Skills ContentPartSettings.Attachable="True">
        <Linkto.LinkField DisplayName="Link to" LinkFieldSettings.Required="True" LinkFieldSettings.TargetMode="NewWindow" LinkFieldSettings.LinkTextMode="Optional" />
      </Skills>
    </Parts>
  </Metadata>
  <Data>
    <Skills Id="/alias=skills\/programming-languages\/c" Status="Published">
      <LinkField.Linkto Url="http://en.wikipedia.org/wiki/C_(programming_language)" />
      <AutoroutePart Alias="skills/programming-languages/c" UseCustomPattern="false" />
      <TitlePart Title="C" />
      <TermPart Count="2" Selectable="true" Weight="0" TaxonomyId="/alias=skills" Path="/alias=skills\/programming-languages" />
      <CommonPart Owner="/User.UserName=admin" Container="/alias=skills\/programming-languages" CreatedUtc="2013-02-14T10:33:23Z" PublishedUtc="2013-02-17T14:43:50Z" ModifiedUtc="2013-02-17T14:43:50Z" />
    </Skills>
    <Skills Id="/alias=skills\/programming-languages\/c-3" Status="Published">
      <LinkField.Linkto Url="http://en.wikipedia.org/wiki/C_Sharp_(programming_language)" />
      <AutoroutePart Alias="skills/programming-languages/c-3" UseCustomPattern="false" />
      <TitlePart Title="C#" />
      <TermPart Count="3" Selectable="true" Weight="0" TaxonomyId="/alias=skills" Path="/alias=skills\/programming-languages" />
      <CommonPart Owner="/User.UserName=admin" Container="/alias=skills\/programming-languages" CreatedUtc="2013-02-14T10:33:53Z" PublishedUtc="2013-02-17T14:44:10Z" ModifiedUtc="2013-02-17T14:44:10Z" />
    </Skills>
    <Skills Id="/alias=skills\/programming-languages\/c-2" Status="Published">
      <LinkField.Linkto Url="http://en.wikipedia.org/wiki/C%2B%2B" />
      <AutoroutePart Alias="skills/programming-languages/c-2" UseCustomPattern="false" />
      <TitlePart Title="C++" />
      <TermPart Count="2" Selectable="true" Weight="0" TaxonomyId="/alias=skills" Path="/alias=skills\/programming-languages" />
      <CommonPart Owner="/User.UserName=admin" Container="/alias=skills\/programming-languages" CreatedUtc="2013-02-14T10:33:32Z" PublishedUtc="2013-02-17T14:44:31Z" ModifiedUtc="2013-02-17T14:44:31Z" />
    </Skills>
    <Skills Id="/alias=skills\/database\/mysql" Status="Published">
      <LinkField.Linkto Url="http://en.wikipedia.org/wiki/MySQL" />
      <AutoroutePart Alias="skills/database/mysql" UseCustomPattern="false" />
      <TitlePart Title="MySQL" />
      <TermPart Count="2" Selectable="true" Weight="0" TaxonomyId="/alias=skills" Path="/alias=skills\/database" />
      <CommonPart Owner="/User.UserName=admin" Container="/alias=skills\/database" CreatedUtc="2013-02-14T10:39:55Z" PublishedUtc="2013-02-17T14:47:47Z" ModifiedUtc="2013-02-17T14:47:47Z" />
    </Skills>
    <Skills Id="/alias=skills\/database\/sql-server" Status="Published">
      <LinkField.Linkto Url="http://en.wikipedia.org/wiki/Microsoft_SQL_Server" />
      <AutoroutePart Alias="skills/database/sql-server" UseCustomPattern="false" />
      <TitlePart Title="SQL Server" />
      <TermPart Count="3" Selectable="true" Weight="0" TaxonomyId="/alias=skills" Path="/alias=skills\/database" />
      <CommonPart Owner="/User.UserName=admin" Container="/alias=skills\/database" CreatedUtc="2013-02-14T10:39:36Z" PublishedUtc="2013-02-17T14:48:44Z" ModifiedUtc="2013-02-17T14:48:44Z" />
    </Skills>
    <Skills Id="/alias=skills\/programming-languages" Status="Published">
      <LinkField.Linkto Url="http://en.wikipedia.org/wiki/Programming_language" />
      <AutoroutePart Alias="skills/programming-languages" UseCustomPattern="false" />
      <TitlePart Title="Programming languages" />
      <TermPart Count="3" Selectable="true" Weight="0" TaxonomyId="/alias=skills" Path="" />
      <CommonPart Owner="/User.UserName=admin" Container="/alias=skills" CreatedUtc="2013-02-14T10:32:58Z" PublishedUtc="2013-02-17T17:08:36Z" ModifiedUtc="2013-02-17T17:08:36Z" />
    </Skills>
    <Skills Id="/alias=skills\/database" Status="Published">
      <LinkField.Linkto Url="http://en.wikipedia.org/wiki/Database" />
      <AutoroutePart Alias="skills/database" UseCustomPattern="false" />
      <TitlePart Title="Database" />
      <TermPart Count="3" Selectable="true" Weight="0" TaxonomyId="/alias=skills" Path="" />
      <CommonPart Owner="/User.UserName=admin" Container="/alias=skills" CreatedUtc="2013-02-14T10:38:39Z" PublishedUtc="2013-02-17T17:08:51Z" ModifiedUtc="2013-02-17T17:08:51Z" />
    </Skills>
    <Taxonomy Id="/alias=skills" Status="Published">
      <AutoroutePart Alias="skills" UseCustomPattern="false" />
      <TitlePart Title="Skills" />
      <TaxonomyPart TermTypeName="Skills" />
      <TaxonomyMenuItemPart RenderMenuItem="false" />
      <CommonPart Owner="/User.UserName=admin" CreatedUtc="2013-02-13T15:59:14Z" PublishedUtc="2013-02-13T15:59:14Z" ModifiedUtc="2013-02-13T15:59:14Z" />
    </Taxonomy>
  </Data>
</Orchard>
Thank you in advance for your insight.
Feb 19, 2013 at 6:59 AM
Anyone please ?

ps: How do I put colour syntax in the <code> section ? It's unreadable in mono-chrome :(
Feb 20, 2013 at 7:33 AM
Sébastien ?