diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 68ca256..dc546d0 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,11 +1,9 @@ -# see https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml name: site on: push: {branches: [main], tags-ignore: ['**']} pull_request: schedule: [{cron: '0 10 * * 6'}] # M H d m w (Sat 10:00) permissions: - # allow GITHUB_TOKEN to deploy to GitHub Pages contents: read pages: write id-token: write @@ -21,7 +19,7 @@ jobs: - uses: actions/setup-python@v4 with: {python-version: '3.11'} - run: pip install -r requirements.txt pyyaml - - name: check CITATION.cff & .zenodo.json + - name: Check CITATION.cff & .zenodo.json run: | python < _site/index.html + sed "s#DESTINATION#https://book.premai.io/$SITE_PREFIX#g" _templates/page.html > _site/index.html - uses: actions/upload-pages-artifact@v2 deploy: if: github.ref == 'refs/heads/main' diff --git a/_config.yml b/_config.yml index 2b92b0c..cc19240 100644 --- a/_config.yml +++ b/_config.yml @@ -11,7 +11,7 @@ only_build_toc_files: true exclude_patterns: [.github/*] html: - # Removed baseurl here to avoid conflicts + # No "baseurl" here to avoid conflicts with the theme favicon: assets/favicon.ico use_edit_page_button: true use_repository_button: true @@ -30,7 +30,7 @@ parse: This chapter is still being written & reviewed. Please do post links & discussion in the {{ '[ comments]({}-comments)'.format(env.docname) }} below, or {{ '[ open a pull request]({}/edit/main/{}.md)'.format( - env.config.html_theme_options.repository_url, env.docname) + env.config.html_context.book_baseurl, env.docname) }}! table_feedback: | ```{admonition} Feedback @@ -38,7 +38,7 @@ parse: Is the table above outdated or missing an important model? Let us know in the {{ '[ comments]({}-comments)'.format(env.docname) }} below, or {{ '[ open a pull request]({}/edit/main/{}.md)'.format( - env.config.html_theme_options.repository_url, env.docname) + env.config.html_context.book_baseurl, env.docname) }}! ``` comments: | @@ -48,7 +48,7 @@ parse: :class: attention Missing something important? Let us know in the comments below, or {{ '[ open a pull request]({}/edit/main/{}.md)'.format( - env.config.html_theme_options.repository_url, env.docname) + env.config.html_context.book_baseurl, env.docname) }}! ``` @@ -107,15 +107,15 @@ sphinx: prem_theme: . recursive_update: true config: - # Add templates_path so Sphinx can see your _templates/page.html override + # Ensure Sphinx sees _templates/page.html templates_path: ["_templates"] + # Use your custom theme html_theme: prem_theme - html_theme_options: - # (NEW) Provide your base URL here, so you can reference it in page.html as {{ theme_options.baseurl }} - baseurl: https://book.premai.io/state-of-open-source-ai - navigation_with_keys: false - use_download_button: false + + # Put your custom base URL in html_context to avoid "unsupported theme option" warnings + html_context: + book_baseurl: https://book.premai.io/state-of-open-source-ai myst_heading_anchors: 4 html_js_files: diff --git a/_templates/page.html b/_templates/page.html index 87c7137..c601414 100644 --- a/_templates/page.html +++ b/_templates/page.html @@ -1,16 +1,24 @@ {% extends "!page.html" %} {% block meta %} - - - + + + + -{{ super() }} +{{ super() }} {# Retain any additional meta tags provided by the theme #} {% endblock meta %} {% block main %} -

Redirecting…

-

Click here if you are not redirected.

-{{ super() }} + +

Redirecting...

+

+ If you are not redirected automatically, please + click here. +

+ +{{ super() }} {# Retain the normal page content provided by the theme #} {% endblock main %}