先丢 demo:
https://staticmotion.zenan.ch 和 https://blog.zenan.ch
GitHub:
https://github.com/alanzchen/static-motion
快速部署
啥都不需要,你甚至都不需要 clone 到本地。只需要一个 Github 账号!
- Fork 这个项目。
- 在 Netlify 注册一个新的 site (拽一个空 zip 进去),同时记下 Site ID 并注册一个 Access Token。
- 在 Travis CI 中,为刚 Fork 的 repo 启用 Travis CI。设置环境变量(见下)。
- 没下一步了!让 Travis CI build 一次吧。两分钟后,你的网站应该已经在 Netlify 上启用了。
当然,还有一些非常方便的自定义选项( Google Analytics + Disqus ),详见: https://staticmotion.zenan.ch/customization
环境变量
(懒得翻译了,反正估计看名字看得懂)
See conf.py for example.
ACCESS_TOKEN: fill your Netlify access token. (Remember to secure it!)SITE_ID: The "API ID" of your Netlify site.index: The URL of your index page on Notion.so.title_sep: Your title separator. No space around!description: Your site description. "Remember to quote your string!"base_url: Your site URL. (must end with /)twitter: Your twitter ID. Declare an empty string if you do not want it.build_mobile: Will build a mobile version of your entire site at /m/ if this option present.
已知问题
- Embedded elements might not work.
- Embedded tweets are not working.
- Fonts in code blocks may flicker slightly.
- Pages with the same base url but with different hash cannot coexist in the same site.
Stack
这其实是一个非常非典型的「生成器」。
Static Motion = Selenium + Chrome + Beautiful Soup
由 Travis CI 自动抓取并部署到 Netlify 上。
由于本质上是爬虫,并进行一些非常 dirty 的处理,Static Motion 可能因为 Notion.so 界面的改变而随时 break down。不建议使用在生产环境中,个人博客和主页可以考虑折腾一下。
为什么 Notion.so 写博客?
好用啊!排版非常自由,组建丰富,编辑体验好……
EOF
欢迎 Fork and merge!
附: 前情提要 /t/372177