Cannot get Descendants of Specific Document Type to Show
I have been working for hours trying to get a Partial View Macro for displaying a simple list of document types to work. I have tried virtually everything on this forum, as well as other sites, and it simply won't work.
When I simplify this by leaving out the Document Type parameter, it works fine (I get a list of every page on the site):
inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var list = CurrentPage.AncestorOrSelf("Home").Descendants();
}
<ul>
@foreach(var item in list){
<li>
<p>@item.Name</p>
</li>
}
</ul>
However, if I add the name of the Document Type, I get a blank list:
[snip] var list = CurrentPage.AncestorOrSelf("Home").Descendants("ProductDetails");
I have multiple pages of this document type published; they appear just fine in my site navigation.
What am I doing wrong?!?! Any and all help with this is most appreciated!
OK, folks - I figured this out on my own. It's a "newbie" issue, but just in case someone else does the same thing I did, I'm passing this along to prevent someone else going through the same pain.
In the Documentation, I noticed a property called DocumentTypeAlias, so I decided to add this to the code that I was getting to work to see if there was something unexpected happening. Sure enough, all the pages had something different than what I thought was the "alias". I was expecting this to be the Document Type "title"; however, what I was getting was something completely different!
I did not notice the tiny "alias" icon to the right of the Document Type Title text box:
Once I unlocked this, changed it to what I intended, and republished, things worked like a charm!
Cannot get Descendants of Specific Document Type to Show
I have been working for hours trying to get a Partial View Macro for displaying a simple list of document types to work. I have tried virtually everything on this forum, as well as other sites, and it simply won't work.
When I simplify this by leaving out the Document Type parameter, it works fine (I get a list of every page on the site):
However, if I add the name of the Document Type, I get a blank list:
I have multiple pages of this document type published; they appear just fine in my site navigation.
What am I doing wrong?!?! Any and all help with this is most appreciated!
OK, folks - I figured this out on my own. It's a "newbie" issue, but just in case someone else does the same thing I did, I'm passing this along to prevent someone else going through the same pain.
In the Documentation, I noticed a property called DocumentTypeAlias, so I decided to add this to the code that I was getting to work to see if there was something unexpected happening. Sure enough, all the pages had something different than what I thought was the "alias". I was expecting this to be the Document Type "title"; however, what I was getting was something completely different!
I did not notice the tiny "alias" icon to the right of the Document Type Title text box:
Once I unlocked this, changed it to what I intended, and republished, things worked like a charm!
Hope this helps another newbie in the future!
is working on a reply...