diff --git a/assets/scripts/DocsNav.yml b/assets/scripts/DocsNav.yml index 440e9e61b..14614d1fd 100644 --- a/assets/scripts/DocsNav.yml +++ b/assets/scripts/DocsNav.yml @@ -3,6 +3,8 @@ name: Add Navbar on: page_build: # Triggers the workflow on push events to gh-pages branch workflow_dispatch: # Allows manual triggering + schedule: + - cron: '0 0 * * 0' # Runs every week on Sunday at midnight (UTC) jobs: add-navbar: @@ -27,9 +29,12 @@ jobs: run: | git config user.name github-actions[bot] git config user.email github-actions[bot]@users.noreply.github.com + + # Define the URL of the navbar to be used + NAVBAR_URL="https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/TuringNavbar.html" # Update all HTML files in the current directory (gh-pages root) - ./insert_navbar.sh . + ./insert_navbar.sh . $NAVBAR_URL # Remove the insert_navbar.sh file rm insert_navbar.sh diff --git a/assets/scripts/JuliaGPNavbar.html b/assets/scripts/JuliaGPNavbar.html new file mode 100644 index 000000000..c4695276b --- /dev/null +++ b/assets/scripts/JuliaGPNavbar.html @@ -0,0 +1,459 @@ + + + + + \ No newline at end of file diff --git a/assets/scripts/README.md b/assets/scripts/README.md index 25fa269b9..97d68f44f 100644 --- a/assets/scripts/README.md +++ b/assets/scripts/README.md @@ -1,12 +1,12 @@ This `scripts` folder contains utilities for building Turing language satellite packages' documentation. - `insert_navbar.sh`: This function inserts a MultiDocumenter-style top navigation bar to `Documenter.jl` generated sites. -- `navbar.html`: the content of the top navigation bar inserted by `insert_navbar.sh`. +- `TuringNavbar.html`: the content of the top navigation bar inserted by `insert_navbar.sh`. ## How to use Add a new Github Actions workflow, `DocsNav.yml`, in your `main` or `master` branch. -You can find `DocsNav.yml` template [here](DocsNav.yml). +You can find `DocsNav.yml` template [here](DocsNav.yml), Update the NAVBAR URL in case you want to use another navigation bar and make sure NAVBAR START AND NAVBAR END comments are there in your new navigation bar. See [AbstractMCMC.jl](https://github.com/TuringLang/AbstractMCMC.jl/blob/master/.github/workflows/DocsNav.yml) for an example. diff --git a/assets/scripts/navbar.html b/assets/scripts/TuringNavbar.html similarity index 100% rename from assets/scripts/navbar.html rename to assets/scripts/TuringNavbar.html diff --git a/assets/scripts/insert_navbar.sh b/assets/scripts/insert_navbar.sh index e407a35e5..19eb549e5 100644 --- a/assets/scripts/insert_navbar.sh +++ b/assets/scripts/insert_navbar.sh @@ -1,16 +1,22 @@ #!/bin/bash -# This script inserts a top navigation bar (e.g., `navbar.html`) into Documenter.jl generated sites. +# This script inserts a top navigation bar into Documenter.jl generated sites. # The resulting output is similar to MultiDocumenter's navigation menu. The navigation menu is # hard-coded at the moment, which could be improved in the future. # It checks all HTML files in the specified directory and its subdirectories. -# URL of the navigation bar HTML file -NAVBAR_URL="https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/navbar.html" +# Check if the correct number of arguments are provided +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi # Directory containing HTML files (passed as the first argument to the script) HTML_DIR=$1 +# URL of the navigation bar HTML file (passed as the second argument to the script) +NAVBAR_URL=$2 + # Download the navigation bar HTML content NAVBAR_HTML=$(curl -s $NAVBAR_URL)