Repository: timovv/notion-website-template
Branch: main
Commit: 350dd42d5941
Files: 4
Total size: 10.4 KB
Directory structure:
gitextract_9c4czz6f/
├── .github/
│ └── workflows/
│ └── main.yml
├── README.md
├── deploy.sh
└── site.toml
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/main.yml
================================================
name: Publish Notion website to GitHub Pages
on:
# Manual update only.
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout loconotion
uses: actions/checkout@v3
with:
repository: leoncvlt/loconotion
path: loconotion
- name: Checkout this repo
uses: actions/checkout@v3
with:
path: pages_repo
- name: Download and install chromedriver
run: sudo apt install chromium-chromedriver
- name: Install Loconotion dependencies
run: pip install -r loconotion/requirements.txt
- name: Run Loconotion
run: |
python3 loconotion/loconotion --chromedriver chromedriver "pages_repo/site.toml"
- name: Push to GitHub pages
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
GIT_DEPLOY_DIR=../dist/site \
GIT_DEPLOY_BRANCH=gh-pages \
GIT_DEPLOY_REPO="https://${{ github.token }}@github.com/${{ github.repository }}.git" ./deploy.sh
working-directory: pages_repo
================================================
FILE: README.md
================================================
# Notion website template
Make a website using Notion, GitHub Pages and Loconotion in just 5 steps.
1. Fork this repo or press [use this template button](https://github.com/timovv/notion-website-template/generate).
1. Create a Notion page to be your website. This can have subpages, databases, anything supported by [Loconotion](https://github.com/leoncvlt/loconotion).
1. Share your Notion page publicly, and update `site.toml` in your repo to point to it.
1. Run the `Publish Notion website to GitHub Pages` action under the Actions tab of your repo.
1. Update your repo's `Pages` settings to use the `gh-pages` branch, hit save, and voila!
To resync the website, simply run the GitHub action again. `site.toml` can be updated to use any of the settings specified in the [Loconotion README](https://github.com/leoncvlt/loconotion/blob/master/README.md).
## Acknowledgements
Thanks to:
- @leoncvt for creating the Loconotion script
- @X1011 for the original script used to deploy the website to GitHub pages
================================================
FILE: deploy.sh
================================================
#!/usr/bin/env bash
# Originally obtained from https://github.com/X1011/git-directory-deploy, with thanks to the author.
# Used under the BSD 3-Clause License, reproduced below:
#
# BSD 3-Clause License:
#
# Copyright Daniel Smith
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
# The names of the contributors may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -o errexit #abort if any command fails
me=$(basename "$0")
help_message="\
Usage: $me [-c FILE] [<options>]
Deploy generated files to a git branch.
Options:
-h, --help Show this help information.
-v, --verbose Increase verbosity. Useful for debugging.
-e, --allow-empty Allow deployment of an empty directory.
-m, --message MESSAGE Specify the message used when committing on the
deploy branch.
-n, --no-hash Don't append the source commit's hash to the deploy
commit's message.
-c, --config-file PATH Override default & environment variables' values
with those in set in the file at 'PATH'. Must be the
first option specified.
Variables:
GIT_DEPLOY_DIR Folder path containing the files to deploy.
GIT_DEPLOY_BRANCH Commit deployable files to this branch.
GIT_DEPLOY_REPO Push the deploy branch to this repository.
These variables have default values defined in the script. The defaults can be
overridden by environment variables. Any environment variables are overridden
by values set in a '.env' file (if it exists), and in turn by those set in a
file specified by the '--config-file' option."
parse_args() {
# Set args from a local environment file.
if [ -e ".env" ]; then
source .env
fi
# Set args from file specified on the command-line.
if [[ $1 = "-c" || $1 = "--config-file" ]]; then
source "$2"
shift 2
fi
# Parse arg flags
# If something is exposed as an environment variable, set/overwrite it
# here. Otherwise, set/overwrite the internal variable instead.
while : ; do
if [[ $1 = "-h" || $1 = "--help" ]]; then
echo "$help_message"
return 0
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
verbose=true
shift
elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then
allow_empty=true
shift
elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then
commit_message=$2
shift 2
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
GIT_DEPLOY_APPEND_HASH=false
shift
else
break
fi
done
# Set internal option vars from the environment and arg flags. All internal
# vars should be declared here, with sane defaults if applicable.
# Source directory & target branch.
deploy_directory=${GIT_DEPLOY_DIR:-dist}
deploy_branch=${GIT_DEPLOY_BRANCH:-gh-pages}
#if no user identity is already set in the current git environment, use this:
default_username=${GIT_DEPLOY_USERNAME:-deploy.sh}
default_email=${GIT_DEPLOY_EMAIL:-}
#repository to deploy to. must be readable and writable.
repo=${GIT_DEPLOY_REPO:-origin}
#append commit hash to the end of message by default
append_hash=${GIT_DEPLOY_APPEND_HASH:-true}
}
main() {
parse_args "$@"
enable_expanded_output
commit_title=`git log -n 1 --format="%s" HEAD`
commit_hash=` git log -n 1 --format="%H" HEAD`
#default commit message uses last title if a custom one is not supplied
if [[ -z $commit_message ]]; then
commit_message="publish: $commit_title"
fi
#append hash to commit message unless no hash flag was found
if [ $append_hash = true ]; then
commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
fi
previous_branch=`git rev-parse --abbrev-ref HEAD`
if [ ! -d "$deploy_directory" ]; then
echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
return 1
fi
# must use short form of flag in ls for compatibility with OS X and BSD
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
return 1
fi
if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
# deploy_branch exists in $repo; make sure we have the latest version
disable_expanded_output
git fetch --force $repo $deploy_branch:$deploy_branch
enable_expanded_output
fi
# check if deploy_branch exists locally
if git show-ref --verify --quiet "refs/heads/$deploy_branch"
then incremental_deploy
else initial_deploy
fi
restore_head
}
initial_deploy() {
git --work-tree "$deploy_directory" checkout --orphan $deploy_branch
git --work-tree "$deploy_directory" add --all
commit+push
}
incremental_deploy() {
#make deploy_branch the current branch
git symbolic-ref HEAD refs/heads/$deploy_branch
#put the previously committed contents of deploy_branch into the index
git --work-tree "$deploy_directory" reset --mixed --quiet
git --work-tree "$deploy_directory" add --all
set +o errexit
diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$?
set -o errexit
case $diff in
0) echo No changes to files in $deploy_directory. Skipping commit.;;
1) commit+push;;
*)
echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to master, use: git symbolic-ref HEAD refs/heads/master && git reset --mixed >&2
return $diff
;;
esac
}
commit+push() {
set_user_id
git --work-tree "$deploy_directory" commit -m "$commit_message"
disable_expanded_output
#--quiet is important here to avoid outputting the repo URL, which may contain a secret token
git push --quiet $repo $deploy_branch
enable_expanded_output
}
#echo expanded commands as they are executed (for debugging)
enable_expanded_output() {
if [ $verbose ]; then
set -o xtrace
set +o verbose
fi
}
#this is used to avoid outputting the repo URL, which may contain a secret token
disable_expanded_output() {
if [ $verbose ]; then
set +o xtrace
set -o verbose
fi
}
set_user_id() {
if [[ -z `git config user.name` ]]; then
git config user.name "$default_username"
fi
if [[ -z `git config user.email` ]]; then
git config user.email "$default_email"
fi
}
restore_head() {
if [[ $previous_branch = "HEAD" ]]; then
#we weren't on any branch before, so just set HEAD back to the commit it was on
git update-ref --no-deref HEAD $commit_hash $deploy_branch
else
git symbolic-ref HEAD refs/heads/$previous_branch
fi
git reset --mixed
}
filter() {
sed -e "s|$repo|\$repo|g"
}
sanitize() {
"$@" 2> >(filter 1>&2) | filter
}
[[ $1 = --source-only ]] || main "$@"
================================================
FILE: site.toml
================================================
# This is the .toml file passed to Locomotion.
# For information on the different settings available, and an example file,
# see the Locomotion README: https://github.com/leoncvlt/loconotion/blob/master/README.md
# DO NOT CHANGE THIS VALUE. The deploy script relies on the site being deployed to the
# "site" directory.
name = "site"
# This page should be the root of your website. It's important.
page = "<your Notion share URL here>"
gitextract_9c4czz6f/ ├── .github/ │ └── workflows/ │ └── main.yml ├── README.md ├── deploy.sh └── site.toml
Condensed preview — 4 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (11K chars).
[
{
"path": ".github/workflows/main.yml",
"chars": 1214,
"preview": "name: Publish Notion website to GitHub Pages\n\non:\n # Manual update only.\n workflow_dispatch:\n \npermissions:\n content"
},
{
"path": "README.md",
"chars": 1013,
"preview": "# Notion website template\n\nMake a website using Notion, GitHub Pages and Loconotion in just 5 steps.\n\n1. Fork this repo "
},
{
"path": "deploy.sh",
"chars": 7998,
"preview": "#!/usr/bin/env bash\n\n# Originally obtained from https://github.com/X1011/git-directory-deploy, with thanks to the author"
},
{
"path": "site.toml",
"chars": 438,
"preview": "# This is the .toml file passed to Locomotion.\n# For information on the different settings available, and an example fil"
}
]
About this extraction
This page contains the full source code of the timovv/notion-website-template GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 4 files (10.4 KB), approximately 2.8k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.