Cloudflare Pages
Deploying to cloudflare instead of github pages follows the same process as deploying with two small tweaks as mentioned in this link.
- Create your quarto site as usual
- Create .github/workflows/publish.yml from https://quarto.org/docs/publishing/github-pages.html#publish-action. I created my quarto project in Positron, so this was automatically created.
- Split render and publish into two steps
- Use
quarto render
instead ofquarto publish
as you would in the terminal - Use https://github.com/peaceiris/actions-gh-pages to publish to the cf-pages branch, from the rendered _site (or _book directory, depending on your quarto project)
- Use
Replicating the example .github/workflows/publish.yml file from the link:
on:
workflow_dispatch:
push:
branches: main
name: Quarto Publish
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps: - name: Check out repository
uses: actions/checkout@v4
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Render
uses: quarto-dev/quarto-actions/render@v2
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: cf-pages publish_dir: _site
To host your site go to Pages application in your Cloudflare Pages (Under Compute(Workers)>Workers and Pages). Follow the process of connecting to github make sure to point it to the cf-pages branch of your repo and to disable the rendering of your main branch. (you can leave all the build config empty). You can point it to your custom domain at the last step of the process.
Adding passwords
I have a daily logs section that is password protected. This can be done through Zero Trust > Access > Applications
Add two public hostnames. - The first will be your your_wiki.pages.dev
which is where cloudflare deploys your pages by default. - The pages.dev will also render all the subsections so you want those to be protected. - Sections can be protected by adding them to the path
section. So if you want to protect logs
then you enter Domain: your_wiki.pages.dev
and then Path: logs
- second will be your domain if you have one - Set input method to custom and put in the full path: your_wiki.yourdomain.com/logs
The process will guide you through setting the method for getting passwords. The default of using allowed emails with one time password is great. Enter the email that you would like to receive the password to.
Test it out.
Thats it.