/nobloger

a start template for notion.so, with the support of static pages generation provided by noblog.

Primary LanguageAstroMIT LicenseMIT

nobloger

A astro start template for noblog

Demo deployed at humbornjo.github.io/nobloger

nobloger is

  • simple, llight-weight and elegant
  • using full static pages (deal with nested notion pages)
  • with easy deployment

screenshot.png screenshot.png screenshot.png

usage

github page deploy

  1. Duplicate this notion database and migrate all your posts into it. If you are not a notion player, just simply put your blog under "./src/pages/posts/"

    # dont forget to add frontmatter if you are not a notion player
    ---
    layout: ../../layouts/MarkdownPostLayout.astro
    title: "golang @any%"
    tags: ["lang"]
    pubDate: 2024-01-24
    archived: false
    description: ""
    ---
    
  2. Fork this project, modify the file selfie.md under public folder as your self introduction, modify astro.config.mjs as following.

    site: 'https://<YOUR_USER_NAME>.github.io',
    base: '/<REPO_NAME>',
    
  3. Goto "Settings -> Secrets and variables -> actions", add following two secrets to "Repository secrets":

    • NOBLOG_DATABASE_ID: your notion database id.
    • NOTION_API_SECRET: your notion api secret.
  4. Goto "Settings -> Pages" and enable pages by set branch as "main", and source as "Github Actions". enable_page

  5. Goto "Actions -> Deploy to GitHub Pages", press "Run workflow", and press the poped up green "Run workflow".

  6. Wait a few minutes, and visit https://<YOUR_USER_NAME>.github.io/<REPO_NAME>

Enjoy.

todo

  • fix markdown display matter
  • add "search" in blog page
  • add "sort by time" in blog page
  • add "paginator" for blog page (is it necessary to use paginator while having nested page?)
  • better tag selection page, filtering w/ multi-select

help

  • notion api: https://developers.notion.com
  • notion database id:
    # suppose your notion databsae url is "https://www.notion.so/humbornjo/fa0faae85c504934a4a86cfa70302850?v=2abd1079ae134fbd8df2604765baa1df"
    # then your database id is "fa0faae85c504934a4a86cfa70302850"
  • notion host file and image on aws s3, and all such files has a expire time, it appears that the only way is modifying the workflow to deploy page every 2 hours.
    name: Deploy to GitHub Pages
    
    on:
      # Schedule the workflow to run every 2 hours
      schedule:
        - cron: '0 */2 * * *'
  • If you want to use [SPACE] in between math delimiter like "$" and "$$", don't use "~", use "\ " instead.
  • enable github pages, don't forget to click "save".

reference