Skip to content

Commit

Permalink
Merge pull request #426 from AutoResearch/docs/add-site-url
Browse files Browse the repository at this point in the history
docs: add site url (fixes links)
  • Loading branch information
hollandjg authored Jun 2, 2023
2 parents a05186e + 500f1c8 commit b1494cd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
12 changes: 12 additions & 0 deletions docs/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os
from urllib.parse import quote


def basename(path):
return os.path.basename(path)


def on_env(env, config, files, **kwargs):
env.filters["basename"] = basename
env.filters["quote"] = quote
return env
10 changes: 6 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json

site_name: Automated Research Assistant
repo_url: 'https://github.com/autoresearch/autora'
repo_url: 'https://github.com/autoresearch/autora/'
site_url: 'https://autoresearch.github.io/autora/'
edit_uri: 'blob/main/docs/'

extra:
colab_base_url: 'https://colab.research.google.com/github/AutoResearch/autora/blob/gh-pages'
colab_base_url: 'https://colab.research.google.com/github/AutoResearch/autora/blob/gh-pages/'

theme:
name: material
Expand All @@ -26,8 +27,6 @@ theme:
name: Switch to light mode
custom_dir: mkdocs/overrides
features:
- content.action.edit
- content.action.view
- navigation.indexes

plugins:
Expand All @@ -44,6 +43,9 @@ plugins:
execute: false
ignore_h1_titles: true
search: {}
mkdocs-simple-hooks:
hooks:
on_env: "docs.hooks:on_env"

markdown_extensions:
admonition: {}
Expand Down
5 changes: 3 additions & 2 deletions mkdocs/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

{% block content %}
{% if page.nb_url %}
<a href="{{ page.nb_url }}" title="Download Notebook" class="md-content__button md-icon">
<a href="{{ page.canonical_url }}{{ page.file.src_uri | basename | quote }}" title="Download Notebook"
class="md-content__button md-icon">
{% include ".icons/material/download.svg" %}
</a>
<a href="{{ config.extra.colab_base_url }}{{ page.nb_url }}"
<a href="{{ config.extra.colab_base_url }}{{ page.url }}{{ page.file.src_uri | basename | quote }}"
title="Open Notebook in Google Colab" class="md-content__button md-icon">
{% include ".icons/material/play-circle-outline.svg" %}
</a>
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ experiment-runner-recruitment-manager-prolific = [

docs = [
"autora-core[docs]",
"mkdocs-simple-hooks",
]

test = [
Expand Down

0 comments on commit b1494cd

Please sign in to comment.