Skip to content

Commit

Permalink
fix: update google_analytics_id alias
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed May 28, 2024
1 parent b08c12d commit b985ac3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 1 addition & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ html:
# Then we could link to the changelog in the *same* build of the docs.
announcement: '⚠️The 0.13 release refactored our HTML, so double-check your custom CSS rules!⚠️'
favicon: images/favicon.ico
google_analytics_id: UA-52617120-7
home_page_in_navbar: false
use_edit_page_button: true
use_repository_button: true
use_issues_button: true
baseurl: https://jupyterbook.org/
analytics:
google_analytics_id = ''
google_analytics_id: UA-52617120-7

repository:
url: https://github.com/executablebooks/jupyter-book
Expand Down
3 changes: 2 additions & 1 deletion docs/advanced/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ Analytics) into the following directive in your configuration file:

```yaml
html:
google_analytics_id: G-XXXXXXX
analytics:
google_analytics_id: G-XXXXXXX
```
:::{seealso}
Expand Down
12 changes: 12 additions & 0 deletions jupyter_book/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ def get_final_config(
if sphinx_config.get("use_multitoc_numbering"):
sphinx_config["extensions"].append("sphinx_multitoc_numbering")

# Fix for renamed field
google_analytics_id = sphinx_config.get("html", {}).get("google_analytics_id")
if google_analytics_id is not None:
_message_box(
(
"[Warning] The `html.google_analytics_id` configuration value has moved to `html.analytics.google_analytics_id`" # noqa: E501
),
color="orange",
print_func=print,
)
sphinx_config['html']['google_analytics_id'] = google_analytics_id

# finally merge in CLI configuration
_recursive_update(sphinx_config, cli_config or {})

Expand Down

0 comments on commit b985ac3

Please sign in to comment.