comment count in blog list

Options

can anyone advise me as to how to create a  comment count within the blog list and then link to the actual blog post that those comments are from? I have this snippet, but I can't figure out what the code should be for the file name (or single page url). "...list-blog.html" is not a sinlge post file name within my set up.. And, $URL doesn't work either.. ???

<t:if test="totalComments > 0">

<A href="list-blog.html">comments(<t:value id=totalComments></t:value>)</A>

Tagged:

Comments

  • We've done this for Convio's Connection Cafe blog using this code:



    <A href="${url}#comments">Comments (<t:value id="totalcomments"/>)</A>

    That takes you to the "comments" anchor on the single blog post page. Are you sure you are using the proper syntax for referencing the URL property? Since it is inside an HTML tag, you must use the ${url} form.

  • Bruce Keilin:

    We've done this for Convio's Connection Cafe blog using this code:



    <A href="${url}#comments">Comments (<t:value id="totalcomments"/>)</A>

    That takes you to the "comments" anchor on the single blog post page. Are you sure you are using the proper syntax for referencing the URL property? Since it is inside an HTML tag, you must use the ${url} form.

    Thanks for the help.. Any thoughts on how to link this to the anchor within the actual post page ?.. for example, if there are 2 comments for this post the link will go to this page: http://www.nrdcactionfund.org/blog/Rubber-Boots-to-Combat-Boots-Time-to-Tackle-Climate-Crisis.html.. and I would then link to #comments on that page as the achor id?

    As it is now, it just stays within the page of all the post excerpts (example: http://www.nrdcactionfund.org/blog/#comments)

    Here's how I have it set up.

    <t:if test="totalComments > 0"><A href="${url}#comments">Comments (<t:value id=totalcomments></t:value>)</A></t:if>

  • Bill Mann:

    Thanks for the help.. Any thoughts on how to link this to the anchor within the actual post page ?.. for example, if there are 2 comments for this post the link will go to this page: http://www.nrdcactionfund.org/blog/Rubber-Boots-to-Combat-Boots-Time-to-Tackle-Climate-Crisis.html.. and I would then link to #comments on that page as the achor id?

    As it is now, it just stays within the page of all the post excerpts (example: http://www.nrdcactionfund.org/blog/#comments)

    Here's how I have it set up.

    <t:if test="totalComments > 0"><A href="${url}#comments">Comments (<t:value id=totalcomments></t:value>)</A></t:if>

    Is your comment test directly in your blog post list template or does that list template include a comment template? If it's the latter case, that won't work. You want the Blog Post list template to look something like this:


    <H1>Blogs</H1>
    <HR>
    <t:list>
    <P>



    <t:value id="teaser">blog teaser</t:value>



    </p>
    <B><A href="${url}"><t:value id=title>more...</t:value></A></B>
    <BR>
    <t:if test="totalcomments > 0"><B>Comments:</B> <A href="${url}#comments"><t:value
    id=totalComments>Number Here</t:value> comment(s)</A>
    </t:if>
    </t:list></B>

    Let me know if that does it for you.

  • Bruce Keilin:

    Is your comment test directly in your blog post list template or does that list template include a comment template? If it's the latter case, that won't work. You want the Blog Post list template to look something like this:


    <H1>Blogs</H1>
    <HR>
    <t:list>
    <P>



    <t:value id="teaser">blog teaser</t:value>



    </p>
    <B><A href="${url}"><t:value id=title>more...</t:value></A></B>
    <BR>
    <t:if test="totalcomments > 0"><B>Comments:</B> <A href="${url}#comments"><t:value
    id=totalComments>Number Here</t:value> comment(s)</A>
    </t:if>
    </t:list></B>

    Let me know if that does it for you.

    thank you for helping with the blog links!! The comments link worked like how you described. Now.. I am trying to link up the category links to display just the posts within certain categories. I have it set up like this.. but it's obviously incorrect. Any thoughts on this one?/

    <t:if test="category.length > 0"><t:list id=category><A href="http://www.nrdcactionfund.org/blog?category=${name}"><t:value id=label>category </t:value></A><t:if test="index < length">, </t:if></t:list></t:if>

  • Bill Mann:

    thank you for helping with the blog links!! The comments link worked like how you described. Now.. I am trying to link up the category links to display just the posts within certain categories. I have it set up like this.. but it's obviously incorrect. Any thoughts on this one?/

    <t:if test="category.length > 0"><t:list id=category><A href="http://www.nrdcactionfund.org/blog?category=${name}"><t:value id=label>category </t:value></A><t:if test="index < length">, </t:if></t:list></t:if>

    The caategory listing requires two things:

    1. the appropriate links to the category-specific listing e.g. /category-listing.html?category=<CATEGORY>
    2. the listing page itself (e.g. /category-listing.html) with a List template that can be filtered by category. Note: this could

    To make all this work, you need to make sure that the "category" URL parameter name exactly matches the property name you are using to categorize the blog posts. So if the property name for the Blog content type is "topic" then they links need to be ...?topic=<DYNAMIC TOPIC HERE>.

    For Convio's Connection Cafe blog, we use a page named archives.html like this: http://www.connectioncafe.com/posts/archives.html?arpost_categories=content-management. (One additional bit of complexity with the Connection Cafe example is that the list component on the archives.html page is using the "prefix" advanced setting with a value of "ar". That is why the parameter name is "arpost_categories" even though the content type property name is "post_categories". Using the prefix allows us to specifically target a single List component without affecting other List components on the same page.

    Does that make sense?

Categories