Skip to content

luoliguang/notion-blog

 
 

Repository files navigation

Deploy

Deploy to Cloudflare Workers

  • wrangler.toml
name = "blog" #your cloudflare worker's name
main = "build/worker/shim.mjs"
compatibility_date = "2023-03-22"
routes = [{ pattern = "blog.kali-team.cn/*", zone_id = "28eeca2e15ad32083050e97611262653" }] # your domain and zone_id
usage_model = "bundled"
[build]
command = "cargo install -q worker-build && worker-build --release"

[vars]
MY_DOMAIN = "blog.kali-team.cn" # change me
NOTION_DOMAIN = "kali-team.notion.site" # change me
PAGE_MAP = '{"/":"edb6a939baab4424a25fd295b3c51312","/links":"9c74faba0b14441a93c2f94a40da3f79","/donate":"eb55bc48f7fb42bfaef8473d2b7b63aa"}'
COMMENT_MAP = '{"data-repo":"cn-kali-team/notion-blog","data-repo-id":"R_kgDOI1wUgQ","data-category-id":"DIC_kwDOI1wUgc4CZK9O","data-mapping":"title","data-input-position":"top","data-theme":"preferred_color_scheme","data-lang":"zh-CN"}'
PAGE_TITLE = "Kali-Team"
PAGE_DESCRIPTION = "三米前有蕉皮"
ICON_URL = "https://avatars.githubusercontent.com/u/30642514?v=4"
QUERY_BODY = '{"collectionView":{"id":"a5b688dd-2876-4f80-a47d-d84e713ac56e","spaceId":"d4aa424b-d5f8-4dc3-a0fb-e5270f17203e"},"source":{"type":"collection","id":"52de4e5e-ba6e-46a2-9dc5-5581637cf339","spaceId":"d4aa424b-d5f8-4dc3-a0fb-e5270f17203e"},"loader":{"type":"reducer","reducers":{"collection_group_results":{"type":"results","limit":10},"table:uncategorized:title:count":{"type":"aggregation","aggregation":{"property":"title","aggregator":"count"}},"table:uncategorized:[[=B:unique":{"type":"aggregation","aggregation":{"property":"[[=B","aggregator":"unique"}},"table:uncategorized:enzw:date_range":{"type":"aggregation","aggregation":{"property":"enzw","aggregator":"date_range"}}},"sort":[{"property":"enzw","direction":"descending"}],"searchQuery":"","userTimeZone":"Asia/Shanghai"}}'

[placement]
mode = "smart"
  • How to modify a configuration file.
  • PAGE_MAP: routing and page id,like: / => https://kali-team.notion.site/edb6a939baab4424a25fd295b3c51312
  • COMMENT_MAP:comment system, open giscus,After completing the guided tutorial,You will receive:
<script src="https://giscus.app/client.js"
        data-repo="cn-kali-team/notion-blog"
        data-repo-id="R_kgDOI1wUgQ"
        data-category="Announcements"
        data-category-id="DIC_kwDOI1wUgc4CZK9O"
        data-mapping="title"
        data-strict="0"
        data-reactions-enabled="1"
        data-emit-metadata="0"
        data-input-position="bottom"
        data-theme="preferred_color_scheme"
        data-lang="zh-CN"
        crossorigin="anonymous"
        async>
</script>
  • Convert JavaScript attributes to JSON
{
  "data-repo": "cn-kali-team/notion-blog",
  "data-repo-id": "R_kgDOI1wUgQ",
  "data-category-id": "DIC_kwDOI1wUgc4CZK9O",
  "data-mapping": "title",
  "data-input-position": "top",
  "data-theme": "preferred_color_scheme",
  "data-lang": "zh-CN"
}
  • One line string:
'{"data-repo":"cn-kali-team/notion-blog","data-repo-id":"R_kgDOI1wUgQ","data-category-id":"DIC_kwDOI1wUgc4CZK9O","data-mapping":"title","data-input-position":"top","data-theme":"preferred_color_scheme","data-lang":"zh-CN"}'

GitHub Action

  • Fork repository to your accounts
  • Edit your own wrangler.toml file.
  • wrangler-action
  • Open Create Token on cloudflare
  • Use template Edit Cloudflare Workers -> Edit Option -> Continue to summary
  • Copy Token and remember it
  • Open https://github.com/xxx/notion-blog/settings/secrets/actions/new and create a Name CF_API_TOKEN
  • Secret:Your Cloudflare Token

Manual

npx wrangler login
  • deploy to cloudflare
npx wrangler deploy

Notion Blog

Notion Blog

About

One click build your website with Notion for free using wrangler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%