Get Publisher name from PublishModels.PageName class?
m
I have a custom class that returns a Umbraco.Cms.Web.Common.PublishedModels.NewsArticle (NewsArcile is the PageName) and this allows me to get different poperies from it but I can't see to find a property for the name of the person who published the page. I do see a few methods that need things pased to them but not just a property I can straight up pull. Am I missing something? What is the right way to get publisher name?
s
IPublishedContent.CreatorName should be the name of the user who created the document. IPublishedContent.WriterName should be the name of the user who made the last changes. The actual publisher name, which can be system or somebody else who is in charge of publishing isn't available on the IPC as far as i know.
It's a good practice to have a collection of Authors in your content structure and then pick the author(s) on the article. This way you have full control over your content and nothing is automagically/incorrectly added. Example: an editor has issues getting into the backend but there is a deadline, they send the text to somebody else who makes the article in the backend => Creator name is contextually wrong, but technically correct. It also gives you the option to add extra data to your authors, like an image/role/...
m
The collection would be like a property on the document?
s
Ill make you a small example if you want, what version are you using?
But in essence it could look like this Site structure for single site Site/Home [site] -- Blog/News [articleArea] ---- SomeTitle [article] ---- Yet another blogpost [article] --Authors [authorArea] ----Author one [author] ----Author two [author] Site structure for multiple sites with shared authors Site1/Home1 [site] -- Blog/News [articleArea] ---- SomeTitle [article] ---- Yet another blogpost [article] Site2/Home2 [site] -- Blog/News [articleArea] ---- Very original title [article] ---- SomethingCatchy [article] Repositories [repositories] --Authors [authorArea] ----Author one [author] ----Author two [author] Relevant doctypes with properties Article - ... - Author [multiNodeTreePicker-limited to Authors in author area] Author - Name - Social media handles - Avatar image
m
I am on V12.2 and it is a single site. If I am looking at your structure right it looks like your making a content area "Authors" with a page for each person that contains there details. Then I guess the artical would have some linking property somehow? It is 8AM for me and I just finished my night job so maybe I am reading it wrong.
s
Seems like you understand the idea 🙂
m
As I am still new with umbraco can you point me in the direction of making that linking property?
a
You can use the MultiNodeTreePicker datatype for that 🙂
you can then define what kind of types are allowed to be picked
s
m
Thanks for all the help