首先fork此项目https://github.com/wallleap/plain/,我fork后的项目地址是
https://github.com/briteming/plain/ ,然后在此处https://github.com/briteming/plain/settings,勾选issues. 然后访问https://github.com/briteming/plain/issues/new,新建issue.
然后,(以下步骤我是在windows上进行的。)
git clone https://github.com/briteming/plain plain-by-briteming
cd plain-by-briteming
pnpm install
cp
.env.sample .env
nano .env
cat .env
显示:
# [必须配置] TOKEN,不配置获取不到文章,格式必须正确
V_GITHUB_TOKEN="你的GITHUB TOKEN
的值。
GitHub Token 中间任意地方用英文逗号+空格断开"
V_USERNAME="briteming"
V_REPOSITORY="plain"
# [!必须配置] 博客信息
V_TITLE="blog of brite" # 博客标题,例如 V_TITLE="wallleap"
V_DESCRIPTION="主要分享前端知识
" # 博客描述,例如 V_DESCRIPTION="主要分享前端知识"
V_KEYWORDS="前端, web, 博客
" # 博客关键词,例如 V_KEYWORDS="前端, web, 博客"
V_LOGO="./logo.svg"
pnpm build
(此步会遇到错误。解决办法:
nano
src/utils/index.ts
把timerId = setTimeout(() => { 改为:
timerId = window.setTimeout(() => {
pnpm build即可成功,并会生成静态网站的根目录dist)
cd dist
python3 -m http.server 2345
浏览器里访问127.0.0.1:2345即可看到静态网站的效果。
(里面的帖子,比如https://pl-luckypoems-projects.vercel.app/post/11,如果我直接访问它,是无法访问的,这不正常。https://stellular-creponne-e802ce.netlify.app/post/11 也是一样。一定要先访问首页,再点击首页里的posts链接,然后点击标题:"古代中国最早的情诗,只有四个字-候人兮猗", 才能打开帖子https://stellular-creponne-e802ce.netlify.app/post/11
解决办法:先在项目的根目录里,新建
vercel.json
文件,内容如下:
{ "rewrites": [{ "source": "/:path*", "destination": "/index.html" }] }
然后再次上传
静态网站的根目录dist的内容到vercel空间,这次就正常了。)
上传
静态网站的根目录dist的内容到
app.netlify.com空间,也有同样的问题,解决办法:
先在dist目录里,新建
_redirects
文件,内容为/* /index.html 200
然后再次上传
静态网站的根目录dist的内容到netlify空间,这次就正常了,
参考: https://github.com/wallleap/plain/issues/2#issuecomment-2662211832里面的2张图。
https://github.com/wallleap/plain/issues/2#issuecomment-2662311687
按所说的示意图重新部署,
这次ok了:https://plain-wl.netlify.app/posts
另外, 导入项目https://github.com/ymbrite/plain/ 到vercel.com/new而得到的网址:
https://plain-oui4.vercel.app/posts
演示网站:
https://plain-wl.netlify.app/posts
https://plain-oui4.vercel.app/posts
项目地址:https://github.com/wallleap/plain/
https://github.com/wallleap/plain/issues/2
https://github.com/briteming/plain/
https://github.com/ymbrite/plain/
No comments:
Post a Comment