Closed evertalbers closed 8 years ago
@evertalbers If you have the automatic routing activated it should be fixed automatically... Does it not for you?
The contenttype is
paginas:
name: Paginas
singular_name: Pagina
the urls that do work are e.g.
/nl/paginas/projecten
and
/en/paginas/projects
but these do not work:
/nl/projecten
and
/en/projects
@evertalbers Could you post you full routing.yml so I can try it out?
My, you're quick. I'll post the routing in a minute.
BTW, and possibly related, I see that I can translate the slug in the backend, and that the urls are working correctly in the browser, but that the {{ localeswitcher() }}
renders the urls as
/en/paginas/**projects**
and /nl/paginas/**projects**
on the English page and as
/en/paginas/**projecten**
and /en/paginas/**projecten**
on the Dutch page
(which are both the same pagina -record)
So it is not possible make the slug translatable? I expect that SEO fanatics are going to want this.
Here we are, routing.yml:
# This file defines user-definable routes for the frontend of your Bolt website.
# Check below for examples, or read the documentation at http://docs.bolt.cm/templates-routes#routing
# Begin Profin-specific routes
sitemapxml:
path: /sitemap.xml
defaults: { _controller: 'Bolt\Extension\Bolt\Sitemap\Extension::sitemapXml' }
sitemap:
path: /sitemap
defaults: { _controller: 'Bolt\Extension\Bolt\Sitemap\Extension::sitemap' }
paginabinding:
path: /{slug}
defaults: { _controller: 'Bolt\Controllers\Frontend::record', 'contenttypeslug': 'pagina' }
contenttype: paginas
homebinding:
path: /{slug}
defaults: { _controller: 'Bolt\Controllers\Frontend::record', 'contenttypeslug': 'home' }
contenttype: homepages
# categorybinding:
# path: /{doelgroepen}/{slug}
# defaults: { _controller: 'Bolt\Controllers\Frontend::record', 'contenttypeslug': 'paginas', 'doelgroepen': 'zakelijk' }
# requirements:
# doelgroepen: [ 'Bolt\Controllers\Routing::getTaxonomyRequirement', ['particulier', 'zakelijk'] ]
# contenttype: paginas
# End of Profin-specific routes
# These are the routes defining the default behaviour of Bolt's frontend. Changing these
# might give unexpected results. If possible, only add NEW routes above these.
homepage:
path: /
defaults: { _controller: 'Bolt\Controllers\Frontend::homepage' }
search:
path: /search
defaults: { _controller: 'Bolt\Controllers\Frontend::search' }
preview:
path: /preview/{contenttypeslug}
defaults: { _controller: 'Bolt\Controllers\Frontend::preview' }
requirements:
contenttypeslug: 'Bolt\Controllers\Routing::getAnyContentTypeRequirement'
contentlink:
path: /{contenttypeslug}/{slug}
defaults: { _controller: 'Bolt\Controllers\Frontend::record' }
requirements:
contenttypeslug: 'Bolt\Controllers\Routing::getAnyContentTypeRequirement'
taxonomylink:
path: /{taxonomytype}/{slug}
defaults: { _controller: 'Bolt\Controllers\Frontend::taxonomy' }
requirements:
taxonomytype: 'Bolt\Controllers\Routing::getAnyTaxonomyTypeRequirement'
contentlisting:
path: /{contenttypeslug}
defaults: { _controller: 'Bolt\Controllers\Frontend::listing' }
requirements:
contenttypeslug: 'Bolt\Controllers\Routing::getPluralContentTypeRequirement'
Is the error you are getting this: Parameter "slug" for route "paginabinding" must match "[^/]++" ("" given) to generate a corresponding URL.
? (if you go to a non default locale that is, otherwise I assume it's Page pagina/ not found.
, right?)
Stop the presses: after updating Translate, the error is gone.
I was going to write this (below), but then realised I was still working with that quickfix on my issue from a couple of days back, and that you'd probably updated the extension in a less hacky way.
This is was the error on a 'pagina' where I left out the 'pagina/' in the url, still with the routing above:
Error gone, see above :-)
Good to hear, I'll close the issue than. :)
@evertalbers I'm guessing the issue you mentioned today is if the contenttype slug is translateable? As in paginas
in your example?
Yes it was, and that's solved. Only now I see this post so I've been cross-posting/cross-slacking a bit here.
When in a single-language site I would have e.g.
for my "pagina" contenttype to be rendered as
/pagina-slug
what should I do to get
/en/pagina-slug
and/nl/pagina-slug
etc in a site with Bolt translate?And should it be done in the same location in routing.yml?