cd ~
git clone https://github.com/bensmithett/tropical
cd tropical
yarn
yarn build
显示:
Your static site is ready to deploy from dist/static
⚠️ Configure tropical.siteHost in package.json, otherwise links in your JSON Feed won't work!
$ ls ~/tropical/dist/static
显示:
404.html blog-post-1.html happy-festival.html posts.json
assets/ blog-post-2.html index.html
可见,~/tropical/dist/static就是静态网站的根目录。
新建源帖:
yarn page happy-festival
运行此命令后,
源帖happy-festival.mdx就会出现在
~/tropical/src/pages/里,然后去编辑源帖
happy-festival.mdx
.或者这样新建源帖:
cd ~/tropical/src/pages/
nano yangzhou.mdx
cat yangzhou.mdx
显示:
export const meta = {
title: '被评为世界No.1,中国最安逸的城市,它排第二,没谁敢称第一',
tags: ['post'],
date: '2024-11-03 08:47:00'
}
## 被评为世界No.1,中国最安逸的城市,它排第二,没谁敢称第一
此处写正文或html codes.
cd ~/tropical/
yarn build
演示网站:https://resonant-mermaid-bb7877.netlify.app/
项目地址: https://github.com/bensmithett/tropical
官网:https://tropical.js.org/
注意:要预览网站效果时,进入静态网站的根目录后,最好运行serve -l 1234 (由npm install -g serve得到的那个可执行文件serve),然后访问
http://127.0.0.1:1234 ,里面的链接,比如http://127.0.0.1:1234/ce就是可以正常访问的,而无需在网址的最后面加上 .html 才能访问。
如果运行python3 -m http.server 1234 ,就需在网址的最后面加上 .html 才能正常访问.
No comments:
Post a Comment