Build complex sitemap with Umbraco - sitemap

I would like to generate a complex sitemap with Umbraco CMS as it needs to accommodate all the possible links that can be found on the site.
So I would like to have the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://www.example.com/sitemap1.xml.gz</loc>
<lastmod>2004-10-01T18:23:17+00:00</lastmod>
</sitemap>
<sitemap>
<loc>http://www.example.com/sitemap2.xml.gz</loc>
<lastmod>2005-01-01</lastmod>
</sitemap>
....
</sitemapindex>
I cannot find documentation for producing a sitemap like the above from the Umbraco. As I am new to Umbraco CMS, I'd like to ask if I need to create multiple Sitemap pages for example if I have 500.000 pages that I'd like to add, should I create 10 Sitemap views (IPublishedContent) - each one containing up to 50.000 elements- and add them to the Sitemap parent view in the CMS? And if yes, is there a chance I can do this dynamically?

You can create SitemapController where you transform all Umbraco nodes to xml. You can get all nodes using that Umbraco.ContentAtRoot().Descendants().Where(<YOUR_CONDITIONAL>). To convert nodes to XML use XDocument.

Related

How can I move breadcrumb before main title on Magento 2

I would like please your help. I am newbie on Magento 2 and still searching things. I would like to move breadcrumb before title (on category pages, product everywhere). I tried to change it on default.xml <move element="page.main.title" destination="page.top" after="breadcrumbs"/>
but with no luck.
Also i tried to do it from catalog_category_view.xml on vendor/magento/module-catalog/view/frontend/layout but no luck. Can anyone please guide me where can I find the order that is loading?
Can you please help? Thank you in advance
One should not call a title from a breadcrumbs template as this breaks independence.
Instead simply move breadcrumbs on top of main.content container.
<move element="breadcrumbs" destination="main.content" before="-"/>
You can find more info on this at Magento official documentation here : Magento 2 - Reorder recommendation units
Try this,
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<move element="page.main.title" destination="breadcrumbs" before="-" />
</body>
</page>

Adding Images or Thumbnails to Atom 1.0 Entries

This StackOverflow answer suggests that you should use HTML entry content and use a standard <img> tag to link to your images.
<content type="html">
<![CDATA[
<a href="http://test.lvh.me:3000/listings/341-test-pics?locale=en">
<img alt="test_pic" src="http://test.lvh.me:3000/system/images/20/medium/test_pic.jpg?1343246102" />
</a>
]]>
</content>
I have also found something called the Yahoo media extensions here which allows you to add custom additional elements.
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
<!-- ommitted -->
<entry>
<!-- ommitted -->
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="path_to_image.jpg" />
</entry>
</feed>
Google also seems to have its own similar extensions. See here.
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
<!-- ommitted -->
<entry>
<!-- ommitted -->
<g:image_link>http://www.google.com/images/google_sm.gif</g:image_link>
</entry>
</feed>
My own intuition tells me I should simply be able to add links to images like so:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<!-- ommitted -->
<entry>
<!-- ommitted -->
<link rel="enclosure" type="image/png" length="1337"
href="http://example.org/image.png"/>
</entry>
</feed>
What is the correct approach for maximum compatibility?
The best practice is to do what Wordpress RSS 2.0 feeds do — if you want your post image to appear in feedly for example, put the <p><img...></p> at the top of the content. My eleventy setup has post header image inside article, but outside content variable's contents which are used in the feed. I solve the problem adding the image back:
<item>
...
<content:encoded>
<![CDATA[<p>{% include "src/components/partials/post-hero-img.njk" %}</p>{{ post.templateContent | textDeletePresentationDivs | htmlToAbsoluteUrls(absolutePostUrl) | safe }}]]>
</content:encoded>
source in git
I checked, neither Atom nor RSS 2.0 feeds have post images set anywhere as standalone tags. They're simply at the top of the article's content.
With regards to your examples...
The "vanilla" Atom RSS feed has a schema xmlns="http://www.w3.org/2005/Atom" and its documentation is defined in RFC4287.
According to it, "vanilla" Atom RSS feed strictly can have <logo> which is the 2:1 ratio image, the logo of the feed. Sadly, it is placed in the root of XML (notice atom:logo in the spec, it's not atom:entry:logo). Practically, this means, you can put a picture of your RSS feed itself, but not per-article. If you do put <logo> inside <entry>, the feed won't pass the validators and post image won't appear in feedly (I tried).
Also, spec defines <icon> which is vaguely defined as a small, square image, also placed in the root. Feedly seem to detect the website's favicon anyway, although it doesn't hurt to set this tag up in rss explicitly.
That's all there is — Atom spec doesn't officially define a way how to put images per-article.
Here's where additional namespaces come in (or RSS 2.0, different spec, different XML). You mentioned xmlns:media="http://search.yahoo.com/mrss/" in example. I tried it, post images won't show in feedly. Plus, spec link http://search.yahoo.com/mrss/ is not showing any specs.
Google namespace you quoted, xmlns:g="http://base.google.com/ns/1.0" also doesn't work, post images don't show up in feedly.
The link approach, <link rel="enclosure" type="image/png" length="1337" href="http://example.org/image.png"/> would be promising except length is meant to state the filesize in bytes. In Eleventy that's problematic value to get, for example.
To sum up, the best practice is put post header image at the top of the content, inside <content>.

Add custom category templates to magento

I am building a webshop that contains the products for over 25 different shops. For every shop we have a similar but slightly different layout for the homepage. I want to add additional templates to use for every shops sub homepage. I found that i can add templates to local.xml . However I can only get it to work for one template.. What is the correct way to add multiple templates to local.xml ?
<page>
<layouts>
<homepage>
<label>Home Page</label>
<template>page/1column-home.phtml</template>
</homepage>
</layouts>
</page>
Many thx,
You have 2 Solutions :-
To add Layout pages in the select menu as you have to add the XML in Module ( config.xml ) not in theme layout ( local.xml )
So to achieve this create Custom Module and in config.xml
<global>
.......
<page>
<layouts>
<custom_layout_page >
<label>custom_layout_page</label>
<template>page/custom_layout_page.phtml</template>
<layout_handle>custom_layout_page</layout_handle>
</custom_layout_page>
</layouts>
</page>
.......
</global>
See Screen below :
OR:
You can create the template phtml file in your theme, for example in folder
page/category_custom_template.phtml
Then you can use the layout update for the category you want to assign this file as layout page or template root
Like the screen shot below :

MVC Sitemap Provider Persist Parameters

This has been driving me crazy for the last couple of hours. I am using the MVC Sitemap Provider to add breadcrumb functionality.
Let me go through the steps of what I have done so I can make this as clear as possible
Downloaded the resource from Nuget
I then have the following in my sitemap
<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMapNode title="Vehicles" controller="Vehicles" area="Vehicles" action="Index">
<mvcSiteMapNode title="VehicleName" controller="Vehicles" area="Vehicles" action="Showroom" >
<mvcSiteMapNode title="Overview" area="Vehicles" controller="Vehicles" action="Overview" />
</mvcSiteMapNode>
</mvcSiteMapNode>
And I have this in my view
#Html.MvcSiteMap().SiteMapPath()
My first questions is: How can I have in replace "VehicleName" for action Showroom, with my actual VehicleName?
My actual problem is: My id is not persisted through to the parent. For example my url will be localhost:44357/Vehicles/Overview/Soul/1, and the parent url will be localhost:44357/Vehicles/Showroom, instead of localhost:44357/Vehicles/Showroom/Soul/1. The vehiclename in the url is optional, so the url can just be localhost:44357/Vehicles/Showroom/1.
I hope this makes sense
Thanks for your help.
For questions 1: Set the VehicleName on the parent node. For example: ((MvcSiteMapNode)SiteMap.CurrentNode.Parent).RouteValues.Add("VehicleName", "SomeVehicle");. A good option may also be to use dynamic node providers for creating your sitemap structure.
For question 2: [SiteMapPreserveRouteData] should do the trick

How can I control the subreport layout?

My business analysts have created 7 reports (using Report Builder) they want merged into a MEGA-report. I've been trying to do this by wrapping them all in subreports (which you can't use in Report Builder 1.0). While all reports show up, the layouts are all over the place. The subreports seem to reorder themselves.
I've dropped down to only using two reports to try to isolate the error. When this runs, subreport2 shows up above subreport1.
What changes do I need to make to my report, (or the child reports) to get them to display in order?
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="schema">
<InteractiveHeight>11in</InteractiveHeight>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>8.5in</InteractiveWidth>
<rd:SnapToGrid>true</rd:SnapToGrid>
<RightMargin>1in</RightMargin>
<LeftMargin>1in</LeftMargin>
<BottomMargin>1in</BottomMargin>
<rd:ReportID>480f6105-cb4d-4969-b530-81ab5a5e3fb8</rd:ReportID>
<Width>8.5in</Width>
<Body>
<ReportItems>
<Subreport Name="subreport1">
<ReportName>Report1</ReportName>
</Subreport>
<Subreport Name="subreport2">
<ReportName>Report2</ReportName>
</Subreport>
</ReportItems>
<Height>0.5in</Height>
</Body>
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>
Add a Table
Place each subreport in its own table cell
Organize cells for desired layout

Resources