Open dionys1705 opened 7 years ago
I have the same issue. Any way to add (like we can ignore) custom routes?
The Readme notes that if you have your own routes, you might need to add the Sitemap's routes above that, since matching goes top-down:
if you use the
pagebinding
inrouting.yml
(or anything similar like/{slug}
), you need to add the following above that route:
sitemap:
path: /sitemap
defaults: { _controller: sitemap.controller:sitemap }
sitemapXml:
path: /sitemap.xml
defaults: { _controller: sitemap.controller:sitemapXml }
Oh, wait, I misread.
No, unfortunately you can't do that yet. In practice, this is no big deal, because (taking your example), in the sitemap it will probably link to /page/contact
, but when it is indexed, the canonical of that page should mention /contact
, ensuring it gets indexed correctly..
Hi Bob. I've locally added the capability to include menu entries in the xml sitemap, which may cover the OP's use case. What's the procedure for submitting proposed changes for you to review please? I've attached them with a .txt on the end for now.
_menu_sitemap_xml.twig.txt _record_xml.twig.txt sitemap_xml.twig.txt
Please note that I'm not very familiar with GitHub - I normally use Git with another repository provider.
My method of using the menu class to select which menu entries to include is a bit clunky - I haven't thought of a better way yet of ensuring that entries which are in the menu don't appear twice in the sitemap. However, it does add flexibility if someone wants to exclude some menu items for other reasons.
Having this capability becomes more relevant if someone has custom twig in their template (as I do) to combine multiple records on one web page, where these records do not have another route to them.
@sebtombs A pull request would be ideal, since that will allow us to review and merg it in easily, as well as keeping your credits intact (in the git log). If you're used to gitlab or bitbucket, it shouldn't be that different. See here: https://help.github.com/articles/about-pull-requests/
Thanks Bob. I haven't submitted the pull yet because of something I am seeing in git diff. I made my original changes from the latest (according to the updater) version brought in as an extension. When I instead do a clone from the GitHub repo, and add my changed files, diff shows extra changes such as:
- <image:loc>{{ url('homepage')|trim('/', 'right') }}{{ value|image(config.get('general/thumbnails/default_image')|first, config.get('general/thumbnails/default_image')|last) }}</image:loc>
+ <image:loc>{{ app.paths.hosturl }}{{ value|image(app.config.get('general/thumbnails/default_image')|first, app.config.get('general/thumbnails/default_image')|last) }}</image:loc>
This appears to be related to the Bolt 4 and Twig 2 compatibility mod that Gawain made in July. Have I cloned the wrong branch?
A way to add custom routes, that are made using templatebinding or pagebinding, to the auto-generated sitemap like @nlemoine and @dionys1705 suggested would be really nice to have.
Is it necessary to make custom routes for my issue posted on stackoverflow: https://stackoverflow.com/questions/49532560/bolt-cm-exclude-contenttype-listing-from-routing ?
For example when I make a page contenttype, I usually do not want to have a listing route. The default routing is fine in almost all cases, so I do not like to configure every contenttype separately... is this possible in some way?
Hello,
I have one hard coded route to an /contact page. Like this:
contact: path: /contact defaults: { _controller: 'Bolt\Controllers\Frontend::template', template: 'contact' }
The above route is not shown in the Sitemap. Is there a way to add this to the sitemap?