Skip to content

How to dynamically load and generate pages? #1112

Answered by Mister-Hope
kaosine asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to render page "Pure dymanicly"

What I mean is that you are trying to load api and register routes at runtime.

That means you are dropping vuepress SSG support. Any static HTML content will no longer be generated.

This means you have to deal 2 situation:

  1. Handle redirect yourself like using other SPA. i.e.: you will get a 404 (not 404 page) when you visit a dynamic route directly, you should redirect them to /404.html or /index.htm
  2. You should always detect current route path in layouts, if it fits some of your route patterns, do redirect to a loading page, then back to 404 if the api is not giving result, or register the route with layout you need and direct to the route if …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kaosine
Comment options

Answer selected by Mister-Hope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants