Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
set -e
&& pip install "jupyter-book<2"
&& jupyter-book build jupyterbook
&& python jupyterbook/add_header.py

- name: GitHub Pages action
if: success() && github.event_name == 'release'
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
- id: add-trailing-comma

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
rev: v0.15.22
hooks:
- id: ruff

Expand All @@ -55,7 +55,7 @@ repos:
- id: nb-strip-paths

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.26.1
rev: v1.28.0
hooks:
- id: zizmor

Expand Down
5 changes: 3 additions & 2 deletions jupyterbook/_config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Book settings
title: The U.S. Integrated Ocean Observing System (IOOS) # The title of the book. Will be placed in the left navbar.
title: The U.S. Integrated Ocean Observing System (IOOS)
author: IOOS # The author of the book
logo: images/IOOS_logo.png # A path to the book logo

Expand Down Expand Up @@ -44,7 +44,8 @@ html:
use_edit_page_button: false # Whether to add an "edit this page" button to pages. If `true`, repository information in repository: must be filled in
use_repository_button: true # Whether to add a link to your repository button
use_issues_button: true # Whether to add an "open an issue" button
extra_navbar: <a href="https://ioos.us">IOOS</a> # Will be displayed underneath the left navbar.
# Hitting https://github.com/jupyter-book/jupyter-book/issues/1966
extra_navbar: <a href="https://ioos.us">IOOS</a>
extra_footer: <a href=https://ioos.noaa.gov> ioos.noaa.gov </a> &nbsp
<a href=https://www.facebook.com/usioosgov> Facebook </a> &nbsp
<a href=https://www.twitter.com/usioosgov> Twitter </a> &nbsp
Expand Down
24 changes: 24 additions & 0 deletions jupyterbook/add_header.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from pathlib import Path

path = Path(__file__).absolute().parent


def add_header(fname):
ioos_ui_components_min_js = """\n<script src="https://dgd6r9iiqa8y9.cloudfront.net/ioos-ui-components.min.js"></script>\n"""
ioos_header = """\n<ioos-header variant="compact" theme="auto"></ioos-header>\n"""

with open(fname) as f:
lines = f.readlines()

with open(fname, "w") as out:
for line in lines:
if line.strip().startswith("<title"):
line = line + f"\n{ioos_ui_components_min_js}"
if line.strip().startswith("<body"):
line = line + f"\n{ioos_header}"
out.write(line)


if "__main__" == __name__:
for fname in path.glob("_build/html/**/*.html"):
add_header(fname)
Loading