When I use smart blog it always show only default author name my code is as follows
@{// Get this blogs root, does not use an id because there may be more thanone blogdynamicblogRoot=CurrentPage.AncestorOrSelf("SmartBlogBlog");// Get the posts in this blogdynamicposts=blogRoot.Descendants("SmartBlogPost");//List of authorsList<string>authors=newList<string>();System.Xml.XmlDocumentdocument=newSystem.Xml.XmlDocument();document.Load(AppDomain.CurrentDomain.BaseDirectory+"/config/SmartBlog.config");// Loop through the posts to retrieve the authors and generate a list without duplicating them.foreach(dynamicpostinposts){stringauthor=post.author.Length>0?post.author.ToString():document.GetElementsByTagName("defaultAuthor")[0].InnerText;if(!authors.Contains(author)){authors.Add(author);}}<spanclass="smartSubTitle smartTopBorder">Authors</span><br/>// Loop through the generated authors list and add them tothe pageforeach(stringauthorinauthors){<ahref="@Umbraco.NiceUrl(blogRoot.Id)?author=@author">@author</a><br/>}}
i always get default author name but i have many authors name in authors.please help me how can i solve this issue
If you go into the SmartBlog Management tab in the Content Section (Root node) and remove the Default Author, the authors entered at the post level will show. With that said, I am having trouble with the Author List on the right side to update,
Spent the day trying to make the SmartListAuthors.cshtml work when there is no default author. Below is the screenshot. There are authors, but not showing on the right-side list. Code is out of the box, however is currently on localhost. Any suggestions would be greatly appreciated.
How to Show All Authors Name
When I use smart blog it always show only default author name my code is as follows
i always get default author name but i have many authors name in authors.please help me how can i solve this issue
If you go into the SmartBlog Management tab in the Content Section (Root node) and remove the Default Author, the authors entered at the post level will show. With that said, I am having trouble with the Author List on the right side to update,
Spent the day trying to make the SmartListAuthors.cshtml work when there is no default author. Below is the screenshot. There are authors, but not showing on the right-side list. Code is out of the box, however is currently on localhost. Any suggestions would be greatly appreciated.
FOUND IT! Prateek Sharma In the SmartListAuthors.cshtml
existing code:
Replace with:
foreach(dynamic post in posts) { string author = post.smartBlogAuthor.Length > 0 ? post.smartBlogAuthor.ToString() : document.GetElementsByTagName("defaultAuthor")[0].InnerText; if(!authors.Contains(author)) { authors.Add(author); } }
is working on a reply...