Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Route's #31

Open
dionys1705 opened this issue May 19, 2017 · 8 comments
Open

Custom Route's #31

dionys1705 opened this issue May 19, 2017 · 8 comments

Comments

@dionys1705
Copy link

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?

@nlemoine
Copy link

I have the same issue. Any way to add (like we can ignore) custom routes?

@bobdenotter
Copy link
Member

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 in routing.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 }

@bobdenotter
Copy link
Member

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..

@sebtombs
Copy link

sebtombs commented Sep 6, 2017

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.

@bobdenotter
Copy link
Member

@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/

@sebtombs
Copy link

sebtombs commented Sep 7, 2017

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?

@pragmaworking
Copy link

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.

@ghost
Copy link

ghost commented Apr 8, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants