Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Dynamic routes #4

Closed
adalberth opened this issue Oct 7, 2016 · 5 comments
Closed

Dynamic routes #4

adalberth opened this issue Oct 7, 2016 · 5 comments

Comments

@adalberth
Copy link

adalberth commented Oct 7, 2016

Is it possible to to have dynamic routes/links like:
[ '/', '/contact', '/exercises/:exercise' ],

So that is prerenders all pages in under exercises?

@chrisvfritz
Copy link
Owner

It'd be impossible for the plugin to know which exercises actually exist, but you can accomplish this another way. Just connect to your database or read from the file system to compile a list of all the links to existing exercises.

@lyyourc
Copy link

lyyourc commented Feb 23, 2017

Can I make a api request to get ids of exercises rather than database and file system =。=
That is: Can I make a api request in webpack.config.js file?

@hurradieweltgehtunter
Copy link

hurradieweltgehtunter commented Aug 22, 2017

Just came upon the same issue. I thought about to read a external file to insert in the list of routes to pre-render. But i don't know how.

Just connect to your database or read from the file system to compile a list of all the links to existing exercises.

Could you be a little mire specific how to do this?

@Iyyourc I'm searching for doing a api request inside my webpack.config too. Did you get it to work?

@ghost
Copy link

ghost commented Aug 30, 2017

@hurradieweltgehtunter this answer by @trusktr on Mar 23 guided me in the right direction here. I was able to grab my slugs of my blog posts and then prerender those rotues.

A word of caution though, when a new route is added (ie new blog post) this must be run again! If this is something you must do often it might be time to look into some SSR.

@adnanmuttaleb
Copy link

adnanmuttaleb commented May 12, 2020

I am having the same issue, is there any reason dynamic route are not supported? I am using this plugin only for social crawler.
I want to understand this: are the pages listed in routes are generated previous to the user request? or the js get executed upon user request? if the case is the latter one, then why dynamic routes are not supported?

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

No branches or pull requests

5 participants