Skip to content

Clarification: Mix Vuepress with vue SPA #2399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidgiga1993 opened this issue May 22, 2020 · 3 comments
Closed

Clarification: Mix Vuepress with vue SPA #2399

davidgiga1993 opened this issue May 22, 2020 · 3 comments

Comments

@davidgiga1993
Copy link

I'm currently using vuepress as a reulgar static blog system but I plan to extend the page with additional pages which require pages with dynamic routes (e.g. /page/;id). The content for the page should be loaded via ajax from a backend (just like in a reulgar vue SPA).

So far I've tried adding the routes in enhanceApp but as already mentioned in #160 this won't work since the generated output doesn't include these files.

To make something like this work my expectation would be the following:

  1. Vuepress generates a fallback.html which has the same content as the other html pages
  2. The webserver should then present fallback.html to the user if no exact match was found in the filesystem (this would be a non vuepress related configuration)
  3. The fallback page uses the router just like when serving the page in vuepress dev docs mode

Is it currently possible to do something like this or is there another way to mix vuepress with "regular" vue on a single page?

@Mister-Hope
Copy link
Contributor

I am a bit confuse at what you need, Vuepress is using SSR, and it does not support with dynamic markdown content. All the contented should be confirmed before build process.

The why is this id unreachable while building? If all the ids are reachable, then you can add it though this

@Mister-Hope
Copy link
Contributor

Also, since vuepress is using SSR, all the links in vuepress will has it's html output, so if you do need to handle some path outsite the vuepress, you can configure you web server to redirect unexisting files to your vue entry point.

@davidgiga1993
Copy link
Author

Thanks for your reply. I actually figured it out by now. I'm now creating a single empty page with dehydrate and then add custom routes on the client side for dynamic pages

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

No branches or pull requests

2 participants