Giter Site home page Giter Site logo

notion-to-jekyll's Introduction

Notion to Jekyll

logo

No more exporting and uploading your Notion posts to your Jekyll blog! Automate it with Notion to Jekyll.

Notion to Jekyll is a GitHub action that automatically synchronizes posts written in Notion with Jekyll blogs.

Caution

Notion to Jekyll deletes all posts that do not exist in Notion. If you want to keep your existing posts, you need to move them to Notion.

See other languages documentation here

Getting started

In order to use Notion to Jekyll, you need to prepare three things. If you are not ready, please refer to the link for each item.

  1. Create Notion to Jekyll database template
  2. Issue Notion API key and create integration
  3. Set up GitHub repository

If you are ready, please proceed to the next step and set up GitHub action.

GitHub action setting

Create a .github/workflows/notion-to-jekyll.yml file in your Jekyll blog repository and write the following.

name: Notion to Jekyll

on:
  schedule:
    - cron: '0 0 * * *' # Run every midnight
  workflow_dispatch:

permissions:
  contents: write # Required for GitHub action to save files

jobs:
  notion-to-jekyll:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Notion to Jekyll synchronization
        uses: whatasame/notion-to-jekyll@v0 # latest version
        with:
          notion_api_key: ${{ secrets.NOTION_API_KEY }}
          notion_database_id: ${{ secrets.NOTION_DATABASE_ID }}

Now, the posts you write in Notion will be automatically synchronized with your Jekyll blog every midnight. Or you can run GitHub action manually.

GitHub action options

Notion to Jekyll provides the following options.

Option name Required Default value Description
notion_api_key Required - Notion API key
notion_database_id Required - Notion database ID
post_dir Optional _posts Target post directory
post_layout Optional post Layout value of Jekyll front matter
post_layout_skip Optional false Whether to skip generating layout variable
commit_user_name Optional {username} Git user name
commit_email Optional {[email protected] Git user email
commit_author Optional {username} Commit author
commit_message Optional Synchronized by Notion to Jekyll Commit message

For example, if you want to change the post_dir option, you can write as follows.

- name: Notion to Jekyll synchronization
  uses: whatasame/notion-to-jekyll@v0
  with:
    notion_api_key: ${{ secrets.NOTION_API_KEY }}
    notion_database_id: ${{ secrets.NOTION_DATABASE_ID }}
    post_dir: _my_posts_dir

FAQ

Permission to repository denied to github-actions[bot]

You may get the following error during the synchronization process.

error: remote: Permission to {username}/{repository}.git denied to github-actions[bot].

fatal: unable to access 'https://github.com/{username}/{repository}.git/': The requested URL returned error: 403

This problem occurs because GitHub action does not have write permission to the repository. To solve this problem, please ensure that you have set up the GitHub workflow permission in notion-to-jekyll.yml file.

permissions:
  contents: write

Contributing

Notion to Jekyll is waiting for your contribution. If you have any problems or improvements while using it, please feel free to leave an issue.

notion-to-jekyll's People

Contributors

whatasame avatar github-actions[bot] avatar dependabot[bot] avatar

Stargazers

Jason T Alborough avatar  avatar

Watchers

 avatar

notion-to-jekyll's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.