Copied to clipboard

Flag this post as spam?

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


  • Nigel Wilson 937 posts 2059 karma points
    Oct 23, 2010 @ 21:01
    Nigel Wilson
    0

    Multiple Blogs and Tag Clouds

    Hi there

    I have a client who wants 2 blogs on their site - no real problem there.

    One thing however is that the tags listing lists all tags for the site.

    To work around this do I need to:

    A. Create multiple templates / document types

    or

    B. Amend the xslt to filter on tags that appear within the specific blog

     

    Anyone got any thoughts / feedback / experience in this issue.

    Thanks

    Nigel

  • Michael Boserup Hesselberg 4 posts 25 karma points
    Nov 14, 2010 @ 11:53
    Michael Boserup Hesselberg
    0

    Hey Nigel,

    Did you find a suitable solution to this?

  • Nigel Wilson 937 posts 2059 karma points
    Nov 15, 2010 @ 00:38
    Nigel Wilson
    0

    Hi Michael

    No sorry - I have identified an alternative solution.

    Regards

    Nigel

  • Robert Foster 424 posts 1626 karma points MVP admin c-trib
    Nov 23, 2010 @ 13:50
    Robert Foster
    0

    As it happens, I have blogged about this a couple of weeks ago...

    http://refactored.com.au/blog/2010/10/19/blog-categories-in-blog4umbraco-take-two

    There's a code download packaged up for umbraco 4.5 listed on the page.  Took me a couple of tries to get this working the way I wanted, but now I have multiple blogs each with their own set of tags. I also had to modify the Blog document type a little to work this out.  No modifications were needed to the base blog4umbraco package though.

    Hope this helps...

     

  • Owen Hope 119 posts 140 karma points
    Dec 07, 2010 @ 23:07
    Owen Hope
    0
  • Robert Foster 424 posts 1626 karma points MVP admin c-trib
    Dec 08, 2010 @ 01:35
    Robert Foster
    0

    Hi Owen,

    Take a look at the followup Blog entry here:

    http://our.umbraco.org/projects/collaboration/blog-4-umbraco/using-blog-4-umbraco/13884-Multiple-Blogs-and-Tag-Clouds?p=0#comment56638

    It deals specfically with this issue...

    Regards,

    Rob.

  • Robert Foster 424 posts 1626 karma points MVP admin c-trib
    Dec 08, 2010 @ 01:36
  • Owen Hope 119 posts 140 karma points
    Dec 08, 2010 @ 01:59
    Owen Hope
    0

    Hi Robert,

    Thank you that is exactly what I am looking for.

    I'm still having some problems getting it going, I have added your XSLT modifications and I am currently getting 0 tags.

    I took a peek in the cmsTags table in the DB and I have 7 tags. They have an "id" "tag" values but "parentId" is null for all, and "group" is blank for all.

    I started to use your implementation from Part 2 (skipping the Categories bit).


    Here are my XSLT's:

    BlogTagCloud.xslt

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp " ">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">
    
    
        <xsl:output method="xml" omit-xml-declaration="yes"/>
    
        <xsl:param name="currentPage"/>
    
        <xsl:variable name="blogRoot" select="$currentPage/ancestor-or-self::Blog"/>
        <xsl:variable name="blogRootId" select="$blogRoot/@id"/>
        <xsl:variable name="blogCategory" select="$blogRoot/category"/>
    
        <xsl:template match="/">
            <div class="tagcloud">
                <p>
    
                <xsl:if test="$blogCategory = ''">
                  <xsl:call-template name="createCloud">
                    <xsl:with-param name="category" select="'default'"/>
                  </xsl:call-template>
                </xsl:if>
                <xsl:if test="$blogCategory != ''">
                  <xsl:call-template name="createCloud">
                    <xsl:with-param name="category" select="$blogCategory"/>
                  </xsl:call-template>
                </xsl:if>
    
                </p>
            </div>
    
        </xsl:template>
    
      <xsl:template name="createCloud">
        <xsl:param name="category"/>
    
        <xsl:for-each select="tagsLib:getAllTagsInGroup($category)/tags/tag [@nodesTagged > 0]">
            <xsl:sort select="." order="ascending"/>
            <a href="{umbraco.library:NiceUrl($blogRootId)}?filterby={.}">
                <xsl:attribute name="class">
                    <xsl:choose>
                        <xsl:when test="@nodesTagged > 5">
                            <xsl:value-of select="string('tagweight5')"  />
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="concat('tagweight',@nodesTagged)"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:attribute>
                <xsl:value-of select="."/>
            </a>
            <xsl:text> </xsl:text>
        </xsl:for-each>
    
      </xsl:template>
    </xsl:stylesheet>

     

    And

     

    BlogCategories.xslt

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
        version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library"
        xmlns:tagsLib="urn:tagsLib"
        exclude-result-prefixes="msxml umbraco.library tagsLib">
    
    
    <xsl:output method="html" omit-xml-declaration="yes"/>
    
    <xsl:param name="currentPage"/>
    
    <xsl:variable name="blogRoot" select="$currentPage/ancestor-or-self::node [@nodeTypeAlias = 'Blog']/@id"/>
    <xsl:variable name="blogRootId" select="$blogRoot/@id"/>
    <xsl:variable name="blogCategory" select="$blogRoot/category"/>
    
    <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:if test="$blogCategory = ''">
            <xsl:call-template name="listCategories">
                    <xsl:with-param name="category" select="'default'"/>
                </xsl:call-template>
        </xsl:if>
        <xsl:if test="$blogCategory != ''">
                <xsl:call-template name="listCategories">
                    <xsl:with-param name="category" select="$blogCategory"/>
                </xsl:call-template>
        </xsl:if>
    </ul>
    
    </xsl:template>
    
    <xsl:template name="listCategories">
        <xsl:param name="category"/>
        <xsl:for-each select="tagsLib:getAllTagsInGroup($category)/tags/tag">
                <li class="cat-link">
                    <a href="{umbraco.library:NiceUrl($blogRootId)}?filterby={current()}"><xsl:value-of select="current()"/></a> (<xsl:value-of select="@nodesTagged"/>)
                </li>
        </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

     

    Any help would be great!

     

    Owen

  • Robert Foster 424 posts 1626 karma points MVP admin c-trib
    Dec 08, 2010 @ 02:26
    Robert Foster
    0

    Hi Owen,

    Have you taken a look at the preceding article about adding a Category to the blog?

    http://refactored.com.au/blog/2010/10/18/adding-a-blog-category-to-blog4umbraco

    It provides a little more background on the whole Blog category issue, but importantly provides a necessary step for getting BlogTags to work properly.  Only the first half of the article is relevant (adding the Category attribute to the Blog document type).

    I'm going to have to formalise the documentation before I release the project to the Our.Umbraco project repository I think...

  • Owen Hope 119 posts 140 karma points
    Dec 08, 2010 @ 18:18
    Owen Hope
    0

    Resolved

  • Owen Hope 119 posts 140 karma points
    Dec 08, 2010 @ 22:01
    Owen Hope
    0

    Woo!

    Had some more problems as your XSLT were designed for 4.5 and since im running 4.0.3 I had to make some changes.

    Thanks,

    Owen

  • Robert Foster 424 posts 1626 karma points MVP admin c-trib
    Dec 09, 2010 @ 02:31
    Robert Foster
    0

    Hi Owen,

    Great work getting the 4.0.3 version of the XSLT files working... try looking in the cmsTags database table... it's possible you have the same tag in the table twice, one will have a null group field.  If you had posts tagged with the same tag before the changes, they most likely are referencing the default tags.  You may have to update those posts by removing all tags, then re-adding them.  If the tags aren't visible, you'll need to either mess around with the database, or change the property's datatype back to the default Tags datatype temporarily.

    Hope this helps, my head is stuffy with a cold at the moment, so probably not explaining myself clearly...

    Rob.

  • Owen Hope 119 posts 140 karma points
    Dec 09, 2010 @ 19:31
    Owen Hope
    0

    Hi Robert,

    Thanks again! I figured out my problem as it was a conflict with passing params to the XSLT.

    For anyone who's interested here are the 4.0.3 XSLT files for Roberts implementation.

    BlogCategories.xslt

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library"
      xmlns:tagsLib="urn:tagsLib"
      exclude-result-prefixes="msxml umbraco.library tagsLib">
    
    
    <xsl:output method="html" omit-xml-declaration="yes"/>
    
    <xsl:param name="currentPage"/>
    
    <xsl:variable name="blogRoot" select="$currentPage/ancestor-or-self::node [@nodeTypeAlias='Blog']"/>
    <xsl:variable name="blogRootId" select="$blogRoot/@id"/>
    <xsl:variable name="blogCategory" select="$blogRoot/data[@alias='category']"/>
    
    <xsl:template match="/">
      <ul>
      <xsl:if test="$blogRootId != '' ">
        <li class="cat-item"><a href="{umbraco.library:NiceUrl($blogRootId)}">All</a> <span> (<xsl:value-of select="count($currentPage/ancestor-or-self::node[@nodeTypeAlias='Blog']//ancestor-or-self::node[@nodeTypeAlias='BlogPost'])"/>)</span></li>
      </xsl:if>
      <xsl:if test="$blogCategory = ''">
        <xsl:call-template name="listCategories">
          <xsl:with-param name="category" select="'default'"/>
        </xsl:call-template>
      </xsl:if>
      <xsl:if test="$blogCategory != ''">
        <xsl:call-template name="listCategories">
          <xsl:with-param name="category" select="$blogCategory"/>
        </xsl:call-template>
    </xsl:if>
    
    </ul>
    
    </xsl:template>
    
    <xsl:template name="listCategories">
      <xsl:param name="category"/>
      <xsl:for-each select="tagsLib:getAllTagsInGroup($category)/tags/tag">
          <li class="cat-link">
              <a href="{umbraco.library:NiceUrl($blogRootId)}?filterby={current()}"><xsl:value-of select="current()"/></a>
          </li>
      </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

     

    BlogTagcloud.xslt

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp " ">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">
    
    
        <xsl:output method="xml" omit-xml-declaration="yes"/>
    
        <xsl:param name="currentPage"/>
    
        <xsl:variable name="blogRoot" select="$currentPage/ancestor-or-self::node [@nodeTypeAlias='Blog']"/>
        <xsl:variable name="blogRootId" select="$blogRoot/@id"/>
        <xsl:variable name="blogCategory" select="$blogRoot/data[@alias='category']"/>
    
        <xsl:template match="/">
            <div class="tagcloud">
                <p>
    
                <xsl:if test="$blogCategory = ''">
                  <xsl:call-template name="createCloud">
                    <xsl:with-param name="category" select="'default'"/>
                  </xsl:call-template>
                </xsl:if>
                <xsl:if test="$blogCategory != ''">
                  <xsl:call-template name="createCloud">
                    <xsl:with-param name="category" select="$blogCategory"/>
                  </xsl:call-template>
                </xsl:if>
    
                </p>
            </div>
    
        </xsl:template>
    
      <xsl:template name="createCloud">
        <xsl:param name="category"/>
        <xsl:for-each select="tagsLib:getAllTagsInGroup($blogCategory)/tags/tag [@nodesTagged > 0]">
            <xsl:sort select="." order="ascending"/>
            <a href="{umbraco.library:NiceUrl($blogRootId)}?filterby={.}">
                <xsl:attribute name="class">
                    <xsl:choose>
                        <xsl:when test="@nodesTagged > 5">
                            <xsl:value-of select="string('tagweight5')"  />
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="concat('tagweight',@nodesTagged)"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:attribute>
                <xsl:value-of select="."/>
            </a>
            <xsl:text> </xsl:text>
        </xsl:for-each>
    
      </xsl:template>
    </xsl:stylesheet>

     

    Last couple days have been consumed with trying to separate two Blogs in one Umbraco installation. Finally have a working version. Lots of toying with Tags, Comments, and Templates! Hopefully one day this will be supported with the original Blog4Umbraco package!

    Thanks again,

     

    Owen

     

     

  • Owen Hope 119 posts 140 karma points
    Dec 09, 2010 @ 21:49
    Owen Hope
    0

    Hi Robert,

    One more questions. I have now moved this over onto my live server and it is working great! However with old "Tags" I can't get those to display. I added the Category to the exisiting Blog Root node, went into the database and changed the "group" to match that of Blog Root Node but the old tags won't display, if i create a new post with tags then those will appear properly. Is there another setting in the DB that I need to change?

    Thanks,

    Owen

  • Robert Foster 424 posts 1626 karma points MVP admin c-trib
    Dec 10, 2010 @ 01:53
    Robert Foster
    0

    Hi Owen,

    The query that getAllTagsInGroup uses is as follows:

    SELECT cmsTags.id, cmsTags.tag, cmsTags.[group], count(cmsTagRelationShip.tagid) AS nodeCount FROM cmsTags
                                INNER JOIN cmsTagRelationShip ON cmsTagRelationShip.tagid = cmsTags.id
                                INNER JOIN cmsContentXml ON cmsContentXml.nodeid = cmsTagRelationShip.nodeId
                                WHERE cmsTags.[group] = @group
                                GROUP BY cmsTags.id, cmsTags.tag, cmsTags.[group]

    However, depending on how many old posts you have, the simplest solution may be to remove and re-apply the tags to them?

    Hope this helps,

    Rob.

  • Sam Pearson 36 posts 89 karma points
    Mar 30, 2011 @ 16:23
    Sam Pearson
    0

    I'm currently trying to use this setup......we're having one major problem though.

    We've followed all the steps, created the categories for each blog, put in the 'blog tags' extension, and changed the BlogCategories.XSLT file to the new one (will do the tag cloud one later)......it works, however... if you try and add tags to your blog post before it has been published, it sets the tags to the group 'default' rather than the specific category group it should belong to.

    Adding it after it has been published results in it being in the right group, but this is not practical from a user perspective as it means locating your blog post node in the tree and adding your tags in that way.

    Does anybody have any ideas as to why this maybe happening?

    We're using Umbraco Version 4.6.1

    Thanks

    Sam

  • Ben McKean 259 posts 514 karma points
    Jul 28, 2011 @ 17:44
    Ben McKean
    0

    I'm also having problems with this. I've posted on the Refactored website and on the package forum but no reply as yet.

    My problem with tagging is basically the tags cannot be retrieved.

    I do the following:

    • Create blog and add a category
    • Create a post and add a tag (everything works up to this point, post gets tag in correct group, all works on front end and everything looks good in DB)
    • When I go back into the post in Umbraco the tags cannot be retrieved (none are displayed) although they still appear in the DB
    • If I republish, the filter by functionality on the front end stops work (everything still in place in DB)
    • If I try and add the same tag again its add it but I can see in the DB it creates a new tag with the group 'default'

    I've been banging my head against a wall for a couple of days with this now and the deadline for completing the site is looming.

    Has anybody had similar problems? Had this working successfully or have any advice?

    Thanks in advance

    Ben

  • Robert Foster 424 posts 1626 karma points MVP admin c-trib
    Jul 28, 2011 @ 17:46
    Robert Foster
    0

    Hi Ben,

    I'm currently looking into the issue that you reported.  How long ago did you download the extensions package?

  • Ben McKean 259 posts 514 karma points
    Jul 28, 2011 @ 17:51
    Ben McKean
    0

    Thanks for the reply Rob, much appreciated.

    Downloaded it either yesterday or the day before. Its looks to me like the save is working correctly because the tags get inserted into the cmsTags table with the correct group. I've used Reflector to look through the code and think it could be a problem within the OnInit method in umbraco.editorControls.tags. I'm not sure if or where the group is set here to retrieve the tags for this group.

  • Ben McKean 259 posts 514 karma points
    Jul 28, 2011 @ 17:53
    Ben McKean
    0

    Thanks for the reply Rob, much appreciated.

    Downloaded it either yesterday or the day before. Its looks to me like the save is working correctly because the tags get inserted into the cmsTags table with the correct group. I've used Reflector to look through the code and think it could be a problem within the OnInit method in umbraco.editorControls.tags. I'm not sure if or where the group is set here to retrieve the tags for this group.

  • Robert Foster 424 posts 1626 karma points MVP admin c-trib
    Jul 28, 2011 @ 19:56
    Robert Foster
    0

    Hi Ben,

    I've resolved the issue and uploaded a new version of the package for you to try out.  Please let me know if you find any other issues and I'll look into it.

    Rob.

  • Ben McKean 259 posts 514 karma points
    Jul 29, 2011 @ 09:59
    Ben McKean
    0

    Hi Rob

    That seems to have worked.

    Thank you very much, much appreciated.

    Ben

  • Bobby 43 posts 63 karma points
    Oct 04, 2011 @ 07:49
    Bobby
    0

    Hi all,

    Can any one help me out what are the steps i need to follow to make this issue resolve in umbraco 4.5 version.I am stuck with this issue since 4 days. i am unable to figure out the coorect way to make it work.

     

    Can any one please guide me in resolving the tags issue.

     

    Thanks

    bobby

Please Sign in or register to post replies

Write your reply to:

Draft