Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hey, guys!
I would like to ask for help on creating a dynamic sitemap for images. I found a similar code example https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/75194-sitemap-for-images#comment-240683
var list = Umbraco.TypedMediaAtRoot(); foreach (var media in list) { if (media.Children != null && media.Children.Count() > 0) { foreach (var childMedia in media.Children) { <li><a href="@childMedia.Url">@childMedia.Name</a></li> } } else { <li><a href="@media.Url">@media.Name</a></li> } }
But it's not complete, and I don`t understand what else to add to the template, Can anyone put on the right path?)
Hi Welch08plt
Describe more please your images map?
Do you want to show all images from umbraco Media section?
How many levels do you have in Umbraco Media section?
Thanks,
Alex
Hi, Alex, thx you for responsiveness
yes, want to show all my images and max level in Media section is 3.
Hi,
Just wrote few lines of code, please try:
@{ var list = Umbraco.TypedMediaAtRoot(); } <ul> @foreach (var rootMediaItem in list) { <li> @rootMediaItem.Name @if (rootMediaItem.DocumentTypeAlias.Equals("Folder") && rootMediaItem.Children != null && rootMediaItem.Children.Any()) { <ul> @foreach (var level2 in rootMediaItem.Children) { <li> @level2.Name @if (level2.DocumentTypeAlias.Equals("Folder") && level2.Children != null && level2.Children.Any()) { <ul> @foreach (var level3 in level2.Children) { <li>@level3.Name</li> } </ul> } </li> } </ul> } </li> } </ul>
Is it what you need?
hi, oh thx so much, it's work..
But I incorrectly put it, and you also confused ... I would like to add pictures from all pages of the site, maybe you know how to do this?
Yes, of course we can do it.
So we need tree of pages? not media items?
What alias of image property on your pages?
Need images link from the pages for xml image sitemap. Max level content section – 3. It would be wonderful if you help get the links, and I'll create the site map structure
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
create dynamic images sitemap
Hey, guys!
I would like to ask for help on creating a dynamic sitemap for images. I found a similar code example https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/75194-sitemap-for-images#comment-240683
But it's not complete, and I don`t understand what else to add to the template, Can anyone put on the right path?)
Hi Welch08plt
Describe more please your images map?
Do you want to show all images from umbraco Media section?
How many levels do you have in Umbraco Media section?
Thanks,
Alex
Hi, Alex, thx you for responsiveness
yes, want to show all my images and max level in Media section is 3.
Hi,
Just wrote few lines of code, please try:
Is it what you need?
Thanks,
Alex
hi, oh thx so much, it's work..
But I incorrectly put it, and you also confused ... I would like to add pictures from all pages of the site, maybe you know how to do this?
Hi Welch08plt
Yes, of course we can do it.
So we need tree of pages? not media items?
What alias of image property on your pages?
Thanks,
Alex
Need images link from the pages for xml image sitemap. Max level content section – 3. It would be wonderful if you help get the links, and I'll create the site map structure
is working on a reply...