This repository demonstrates how apostrophe-workflow's link-to-locale
generates invalid URLs containing apos.prefix
twice, when specifying a prefix in app.js.
When running without a prefix everything works as expected.
This project is based on apostrophe-boilerplate
; apostrophe-workflow
has been added and configured with two locales; a locale switcher has been implemented in views/layout.html
.
Two locales have been defined to be able to demonstrate switching between locales: en-US
and de-AT
, both children of the default
locale.
Apostrophe workflow has been configured with basic options, according the project's README.md
.
First, test the app without a prefix set in app.js
; everything should work as expexted. Then, set a prefix and test again; the links generated by the locale switcher will contain apos.prefix
twice.
To test without a prefix first, make sure to comment out prefix: '/pre' in
app.js`. Then start the app.
docker-compose up mongo
to start Mongonpm i
in another terminal to install packagesnode app apostrophe-groups:add admin admin
to add groupnode app apostrophe-users:add admin admin
to add usernpm start
to start the app
Login at localhost:3000/login
, create the page _New Pagewith slug
/new-pagein the
defaultlocale; export to the
en-US locale (_New Page_/
/new-page) and the
de-AT locale (_Neue Seite_/
/neue-seite`), commit all three versions of the page.
The language selector in the top-right corner implemented in views/layout.html
should display options for United States and Austria. Clicking on Austria should redirect to /neue-seite
, clicking on United States should redirect to /new-page
.
Stop the app. Uncomment prefix: '/pre'
in app.js
. (Re)start the app as described above.
Login at localhost:3000/login
, then go to /new-page
to display New Page. Now click on Austria in the locale switcher in the to-right corner. The link generated is /pre/pre/neue-seite
, which does not exist.
The link-to-locale
route defined in apostrophe-workflow/lib/routes.js
returns a link containing apos.prefix
twice.
I'm not yet sure why this happens and how to fix it.