+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Display Categories and/Tags associated with a Blog Post

Display Categories and/Tags associated with a Blog Post

6 posts, 0 answered
  1. Richard
    Richard avatar
    64 posts
    Registered:
    09 Oct 2012
    28 Sep 2012
    Link to this post
    We are wanting to show a short list of the most recent Blog posts on our home page. I was hoping the Blog Widget would allow me to display all of the things I needed to, but unfortunately it looks as though it doesn't.

    What we're wanting to display is a Title, a summary, a thumbnail, and icons that denote what category/tags the blog post is associated with. I don't want the date, the author, or the 'full story' link.

    I'm a little concerned because I don't see any way to give a post a thumbnail and I haven't been able to find any information on pulling the category or tags. I see that you can edit or create a new template for the blogs widget to use and I would probably do that.

    What would be the code to display the category and/or tags?


    And is there a way to add a thumbnail to a post or pull the image that you add inside a post?

  2. Richard
    Richard avatar
    64 posts
    Registered:
    09 Oct 2012
    02 Oct 2012
    Link to this post
    Ok I've got the Thumbnail figured out. Its a little wonky and I'm sure the users aren't going to like it, but what I've done is added a new custom field for the Thumbnail following these directions. Then created a new widget template for the Blog Lists based on the 'Titles, Dates, and Summaries' template and just put an image tag that's src is the value from the thumbnail custom field <img src='<%# Eval("Thumbnail")%> />'/> . Pretty simple. Though when the users create a blog post they won't be able to upload an image for the post on the same page that they're entering the post. They will have to go to content>images and upload their image beforehand. I can see this causing some problems. Any ideas?

    Also I still need to get the category or tag values? I see that you can insert the category or tags on the right hand side when you edit your template, but it inserts the information as an unordered list, which is good, but I just want to get the values and use the value to fill the src tag of an image i'll use for an icon. So for example if the post had the tags kids and teens, for the tag kids it would fill in the src for the image tag as <img src="kids.jpg" /> then for the teens it would be <img src-"teens.jpg" />. 

    Thanks for your help!
  3. Richard
    Richard avatar
    64 posts
    Registered:
    09 Oct 2012
    14 Dec 2012
    Link to this post
    Does anyone know how to display the categories or tags? I've tried 
    <sf:FieldListView ID="Category" runat="server" 
                    Text="<%$ Resources:EventsResources, Category %>" Properties="Category" 
                    WrapperTagName="li"
                />

    But that doesn't work. I'm clueless.

    Thanks!
  4. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    21 Nov 2016
    19 Dec 2012
    Link to this post
    Hello Richard,

    Please follow the steps below to display Category/Tags to a Blog post widget:
    1. Drag and drop a Blog posts widget to a page
    2. Click the Edit button
    3. Go to List settings
    4. Select a List template and click Edit the selected template
    5. Choose a place where the Category/Tags will be displayed on the template and select them from the list, which is on the right side of the template.

    The following row will be added to the template if you choose Category:

    <sitefinity:HierarchicalTaxonField ID="HierarchicalFieldControl" runat="server" TaxonomyId="E5CD6D69-1543-427b-AD62-688A99F5E7D4" DisplayMode="Read" WebServiceUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc" Expanded="false" TaxonomyMetafieldName="Category" ExpandText="ClickToAddCategories" BindOnServer="true" />

    and the following row will be added to the template for Tags:
    <sitefinity:FlatTaxonField ID="FlatFieldControl" DisplayMode="Read" runat="server" WebServiceUrl="~/Sitefinity/Services/Taxonomies/FlatTaxon.svc" AllowMultipleSelection="true" TaxonomyId="CB0F3A19-A211-48a7-88EC-77495C0F5374" TaxonomyMetafieldName="Tags" Expanded="false" ExpandText="ClickToAddTags" BindOnServer="true" />

    Please review the video demonstration I have recorded. I hope you will find it useful.

    Kind regards,
    Stefani Tacheva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Jeff
    Jeff avatar
    4 posts
    Registered:
    15 Aug 2012
    20 Dec 2012 in reply to Richard
    Link to this post
    Richard,

    We're dealing with similar needs on a blog. Take a look at this post to see how to allow the user to upload a picture instead of having to put a file path into your thumbnail field:

    http://www.sitefinity.com/developer-network/forums/permalink/baLTn1o4KkSQimeRXgwlwQ

    It's very easy to do and is working for us. If you do steps #3 and #4 in the post in that thread by Stanislav Velikov it will provide the user with an image selector instead of a text box.
  6. jason
    jason avatar
    1 posts
    Registered:
    27 Aug 2013
    06 Nov 2013 in reply to Stefani Tacheva
    Link to this post
    How can I display the blog post tags in the single view template? I was successful getting tags to show up on list view, but now single view.
6 posts, 0 answered