Display Categories and/Tags associated with a Blog 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?
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?
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!
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"
/>
<
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"
/>
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:
www.sitefinity.com/.../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.
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.