Replies: 6 comments 6 replies
-
Hmm, IIUC, you've generated some file like Like that file is meant for @app.route("/bar")
def bar():
return render_template("foo.html", **{...}) Which will be serving it at different URL - There is no feasible way to solve the issue. You can generate those placeholders for all possible routes using dynamic routes. But even then there will be errors because hydration will fail after initial load. Or if you do full page load on each route change, then it might work, but will be slower for your end users. VitePress is not a good fit for these cases. You'll need an ISR/SSR framework. Though even then you'll need to make it an API returning html blocks and handle injection directly in vue. Well, if you're making it an API, then you can do client-side rendering on vitepress too, but then you'll need to inject inline HTML which will cause CSP issues for you. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the info. Yes. The file is generated as Note, that I have a I am not using flask, I am using a script that calls Jinja and generates static HTML files. But yes, this will be similar to something like this @app.route('/apidocs/<str:parent>/<member>')
def apidocs(parent, member):
return render_template("foo.html", **{...}) My hope is that I configure If Since |
Beta Was this translation helpful? Give feedback.
-
I simple way to reproduce this behaviour. I have
Expected result: I see the exact same content for what was My hope is that there can be a simple way to tell the vitepress app not to panic when loading |
Beta Was this translation helpful? Give feedback.
-
So... I came up with this POC @brc-dd what do you think ? I can work to move the confige outside of the theme and write documentation and use case example A preview of the changes You configure the theme with your "extenralPages" themeConfig: {
// Map from an URL regex to a vitepress page.
externalPages: [
['.apidocs.*', '/placeholders/apidocs'],
],
logo: { src: '/vitepress-logo-mini.svg', width: 24, height: 24 }, the router is updated not to panic // Helper to detect if pages are loaded outside of the vitepress SPA
let insideVitepress = inBrowser
// This is here to allow loading pages generated by Vitepress
// outside of the SPA.
// The config is in themeConfig as it was was easy to pass it
// but we should have this moved to site config.
let externalPages = siteDataRef.value.themeConfig.externalPages
if (externalPages) {
for (let externalRule of externalPages) {
const externalPagePattern = new RegExp(externalRule[0])
if (externalPagePattern.test(pendingPath)) {
// Make it look like we are accessing the base page.
latestPendingPath = externalRule[1]
pendingPath = externalRule[1]
insideVitepress = false
break
}
}
} This works in dev mode... I am trying to get my local dev environment to also work with |
Beta Was this translation helpful? Give feedback.
-
Now that I read more about So, basically what I need here, is to let |
Beta Was this translation helpful? Give feedback.
-
For now I gave up on working on this functionalty. I need to learn more about how vuejs hydration work and how to setup vuejs/core in dev mode. For my use case, I only needed the HTML/CSS for the header and footer and for now I can manully re-create them. This use case is not supported by |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
For my website I have some pages that are not generated by vitepress.
For example, I have the API docs that are generated using a tool like
pydoctor
... similar to Python Sphinx API docs.For example, I want to generate a Python Jinja2 template.
For the API docs pages, I want to share the same header and footer with the
vitepress
site.I was able to create a placeholder page
For example I have this custom layout
It will generate an .HTML file that I can use as
Jinja2 template
.The files are generated just fine.
The problem, is that when I load the file, the
vitepress
router kicks in and will convert the page into a 404.Is there a way to disable the 404 page routing ?
I still want to use the vite JS code, for example to show/hide the menu for mobile view.... so I don't want to disable the vuejs UI interaction code.
Beta Was this translation helpful? Give feedback.
All reactions