nicejade / markdown-online-editor

📝基于 Vue、Vditor,所构建的在线 Markdown 编辑器,支持流程图、甘特图、时序图、任务列表、HTML 自动转换为 Markdown 等功能;🎉新增「所见即所得」编辑模式。https://niceshare.site/

Home Page:https://markdown.lovejade.cn/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

解决 GitHub Pages 不支持 SPA 应用问题

nicejade opened this issue · comments

Arya - 在线 Markdown 编辑器,是部署在 Github Pages 服务上的;这对于静态网站,是一个很棒的容器;然而,GitHub Pages 本身不支持单页面应用程序的:

GitHub Pages doesn't natively support single page apps. When there is a fresh page load for a url like example.tld/foo, where /foo is a frontend route, the GitHub Pages server returns 404 because it knows nothing of /foo.

对于这个问题,解决的办法比较多;此项目使用 Vue 构建,即可使用 SSR 绕过此问题;或者采用 spa-github-pages 类似已经给出的方案;而,在早期设计的代码中,采用的是 [Prerender SPA Plugin
(https://github.com/chrisvfritz/prerender-spa-plugin),在本地部署前,将单页面应用程序(SPA)中预呈现静态 HTML。这是一个蛮不错的方案,但之前将 export/pngexport/pdf 等公用了同一个路由,导致该页面不能被提渲染(当在 export/png 页面刷新,因为 Github pages 不支持 SPA,会被告知页面 404),所以需要单独予以解决。