vuejs / vitepress

Vite & Vue powered static site generator.

Home Page:https://vitepress.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use custom Layout, markdown in Content area not render in preview mode.

Kythuen opened this issue · comments

Describe the bug

  • When there is development mode, everything is ok.
  • In preview mode, when coming form a direct route link or refresh page, the markdown of the content do not render.

Reproduction

  • come in page /
  • click button to guide page, then route to page /guide, now is ok.
  • then refresh the page at /guide, the content area not render.

Expected behavior

As for a document website, we often hope others come in through a detail page url.

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
    Memory: 14.93 GB / 31.72 GB
  Binaries:
    Node: 20.12.1 - ~\.nvmd\versions\20.12.1\node.EXE
    npm: 10.5.0 - ~\.nvmd\versions\20.12.1\npm.CMD
    pnpm: 8.15.6 - ~\.nvmd\versions\20.12.1\pnpm.CMD
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.19041.3636

Additional context

Validations

I'm facing this issue as well. Exactly the same situation.

I am facing same error

you can solve with nginx. but I think vitepress need to solve this error

nginx resolve

...
    location / {
        # for example.com/ so unpath requests
        if ($http_:path: = "/") {
                rewrite ^(.*)/$ $1 permanent;
        }

        try_files $uri $uri.html $uri/ =404;

        error_page 404 /404.html;

        error_page 403 /404.html;
    }

you're using ClientOnly and Suspense in your layout which will disable SSR for whole app. This is not supported. Use plain vite app if you don't want SSR.

you're using ClientOnly and Suspense in your layout which will disable SSR for whole app. This is not supported. Use plain vite app if you don't want SSR.

thank you, it worked.