Automatically add new routes to new CMS pages

When I add new CMS page in Magento2 Admin Panel I have to add a new route in Vue Storefront to make new page accessible.
Is there possibility to do that automatically? Which files should I modify? I would like to have access to new CMS pages without creating new routes.

Hi Jakubm,

Dynamic routes are already defined in
vuestorefront/src/themes/theme-name/router/index.js
for static pages it is:
{ name: ‘cms-page’, path: ‘/i/:slug’, component: Static }

Where ‘slug’ is your page slug, which is created in magento.

Use getLinkFor(’/slug’) method to create a link;
like:

{{ $t(‘About us’) }}

1 Like

Thanks a lot! It really helped me.