feature: defining url/slug for preview mode of components #141

jackblackCH opened this Issue Sep 7, 2016 · 1 comment


None yet

2 participants

jackblackCH commented Sep 7, 2016 edited

it would be nice to define the url which appears in the preview mode.

i.e via the config files.

the current url of a template component is auto generated by the folder structure and looks like:

  • /components/preview/t-pdp

but i'd like to have more meaningful urls like:

  • /my-product-detail-page

to get this, why not defining a pattern in the config files

// group level of templates
prefix: 'pages',
slug: '/pages'

// and one deeper on component level
title: 'home'
slug: 'my-product-detail-page'

which all results in opening the home page template in preview mode that the url looks like:


@jackblackCH URL routing is actually handled by the theme, not by fractal core itself, and this feature could actually be already be implemented by customising the theme URL schemes. It would be a bit fiddly but I'm not sure that per-component config is really the right sort of place for this sort of thing.

Similar to the way you add a template load path to the theme (http://fractal.build/guide/web/default-theme#template-customisation) you can also add additional URL patterns (see https://github.com/frctl/mandelbrot/blob/master/src/theme.js for how the default routes are set up).

It all badly needs more documentation however so not sure if it's that useful to you right now I'm afraid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment