Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Feb 07, 2011 @ 10:34
    Anthony Candaele
    0

    problem with tags in blog4umbraco

    Hi,

    I have integrated the blog4umbraco package in my website.

    The structure looks like this:

    DVHome
    ..Curriculum vitae
    ..Recent publications
    ..Meetings with students
    ..Visiting students
    ..DVBlog

    In the templates section, I made a custom template for the blog page:

    <asp:content ContentPlaceHolderId="DVMasterContentPlaceholder" runat="server">
      <umbraco:Macro Alias="BlogListPosts" runat="server"></umbraco:Macro>
    </asp:content>

    <asp:content ContentPlaceHolderId="SidebarContentPlaceholder" runat="server">
       <h3>Pages</h3>
       <umbraco:Macro ID="Macro1" Alias="Blogpages" runat="server"></umbraco:Macro>
      <h3>Tags</h3>
      <umbraco:Macro ID="Macro2" Alias="BlogCategories" runat="server"></umbraco:Macro>
      <h3>Archives</h3>
      <umbraco:Macro ID="Macro3" Alias="BlogArchive" runat="server"></umbraco:Macro>
    </asp:content>

    The problem I have though is that the 'tags' section is listing all tagged pages (see screenshot) while I need the blog page only to show the blogpages that where tagged:

    I guess I would have to customize the xslt file BlogCategories.xslt, in particular this code:

    <xsl:template match="/">
        <ul>
            <li class="cat-item">
                <a href="{umbraco.library:NiceUrl($blogRoot)}">All</a>
                <span>
                    &nbsp;(<xsl:value-of select="count($currentPage/ancestor-or-self::Blog//BlogPost)"/>)
                </span>
            </li>
            <xsl:for-each select="tagsLib:getAllTagsInGroup('default')/tags/tag">
                <li class="cat-link">
                    <a href="{umbraco.library:NiceUrl($blogRoot)}?filterby={current()}">
                        <xsl:value-of select="current()"/>
                    </a> (<xsl:value-of select="@nodesTagged"/>)
                </li>
            </xsl:for-each>
        </ul>

    </xsl:template>

    But I'm not really familiar with this, any help would be much appreciated,

    Thanks,

    Anthony Candaele
    Belgium

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 07, 2011 @ 11:08
    Tim
    0

    Hi Anthony,

    Can you clarify what you mean when you say you want to list only the blog pages that were tagged? Do you mean that you want to list blog pages that were tagged the same as the current page, or something different?

    If it's listing blog pages as well as normal pages, you could try to create a separate tag group for the pages to the blog pages (effectively giving you two sets of tags, one for the blog, one for the content pages). If you want both to use the same tags, you could look at creating a new XSLT extension that just lists the tags for the blog page content types. To do that, just lookin the Umbraco source for how it's done in the built in tags control, and use that code to create your own tag list function.

    :)

  • Anthony Candaele 1197 posts 2049 karma points
    Feb 07, 2011 @ 14:19
    Anthony Candaele
    0

    Hi Tim,

    Thanks for the advice, how can I create a seperate tag group?

    If I look in the source code in BlogCategories.xslt I see this code:

    xsl:for-each select="tagsLib:getAllTagsInGroup('default')/tags/tag"

    So I guess I would have to give the 'blog tag group' as parameter for the getAllTagsInGroup method.

    Thanks for your advice,
    Anthony

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 09, 2011 @ 10:08
    Tim
    0

    I think there's a setting in the blog config to set the tag group name (not sure where, don't have it to hand), but yes if you set the group to "blogtags" there, you'd just swap out "default" for "blogtags" and you should be sorted. You may need to re-tag your blog posts though once you've changed the config setting.

  • Anthony Candaele 1197 posts 2049 karma points
    Feb 10, 2011 @ 14:49
    Anthony Candaele
    0

    Hi Tim,

    What do you mean by 'the blog config'? A property the Umbraco Backoffice, or a setting in a config file? I looked in the settings tab of the Blog document type, but there are only two property settings there: 'Blog Name' and 'Blog Description'.

    Thanks for your help,

    Anthony

Please Sign in or register to post replies

Write your reply to:

Draft