Skip to content

Commit 275bf49

Browse files
Merge pull request #156 from premAI-io/fix-links-and-baseurl
Fix links and baseurl
2 parents 3da24a5 + 8b5f66a commit 275bf49

File tree

3 files changed

+39
-25
lines changed

3 files changed

+39
-25
lines changed

.redirect-template.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

_config.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ logo: https://static.premai.io/logo.png
66
repository:
77
url: https://github.com/premAI-io/state-of-open-source-ai
88
branch: main
9+
910
only_build_toc_files: true
1011
exclude_patterns: [.github/*]
12+
1113
html:
12-
baseurl: https://book.premai.io/state-of-open-source-ai
14+
# Removed baseurl here to avoid conflicts
1315
favicon: assets/favicon.ico
1416
use_edit_page_button: true
1517
use_repository_button: true
@@ -19,6 +21,7 @@ html:
1921
label: question
2022
repo: premAI-io/state-of-open-source-ai
2123
theme: preferred-color-scheme
24+
2225
parse:
2326
myst_substitutions:
2427
baseurl: http://localhost:8000
@@ -73,18 +76,17 @@ parse:
7376
<div>
7477
<p>
7578
This book is open source; you can also read &amp; contribute at<br />
76-
<a href="https://github.com/premAI-io/state-of-open-source-ai" target="_blank"><i class="fa-brands fa-github"></i>&nbsp;premAI-io/state-of-open-source-ai</a>.
79+
<a href="https://github.com/premAI-io/state-of-open-source-ai" target="_blank">
80+
<i class="fa-brands fa-github"></i>&nbsp;premAI-io/state-of-open-source-ai
81+
</a>.
7782
</p>
7883
<span class="email-error"></span>
7984
</div>
8085
</div>
8186
</form>
8287
</div>
8388
84-
myst_enable_extensions: # https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html
85-
# needs myst-parser>=0.19 <- https://github.com/executablebooks/MyST-NB/issues/530
86-
#- attrs_block
87-
#- attrs_inline
89+
myst_enable_extensions:
8890
- deflist
8991
- dollarmath
9092
- html_admonition
@@ -93,6 +95,7 @@ parse:
9395
- smartquotes
9496
- substitution
9597
- tasklist
98+
9699
sphinx:
97100
extra_extensions:
98101
- sphinx_last_updated_by_git
@@ -102,12 +105,18 @@ sphinx:
102105
committers: .
103106
bibliography: .
104107
prem_theme: .
105-
recursive_update: true # append to rather than overwrite html_theme_options
108+
recursive_update: true
106109
config:
110+
# Add templates_path so Sphinx can see your _templates/page.html override
111+
templates_path: ["_templates"]
112+
107113
html_theme: prem_theme
108114
html_theme_options:
115+
# (NEW) Provide your base URL here, so you can reference it in page.html as {{ theme_options.baseurl }}
116+
baseurl: https://book.premai.io/state-of-open-source-ai
109117
navigation_with_keys: false
110118
use_download_button: false
119+
111120
myst_heading_anchors: 4
112121
html_js_files:
113122
- [
@@ -117,7 +126,6 @@ sphinx:
117126
linkcheck_ignore:
118127
- http://localhost:8000
119128
- https://github.com/premAI-io/state-of-open-source-ai/edit/main/.*.md
120-
# GitHub anchors
121129
- https://github.com/\w+/\w+/blob/\w+/.*#L\d+(-L\d+)?
122130
- https://github.com/premAI-io/prem-app#.*
123131
- https://github.com/BlinkDL/RWKV-LM#.*
@@ -132,7 +140,6 @@ sphinx:
132140
- https://github.com/onnx/onnx-tensorrt#.*
133141
- https://github.com/onnx/tutorials#.*
134142
- https://gist.github.com/veekaybee/be375ab33085102f9027853128dc5f0e#.*
135-
# misc
136143
- https://www.nytimes.com/2016/04/19/technology/google-books-case.html
137144
- https://doi.org/10.2307/2214413
138145
- https://direct.mit.edu/daed/article/151/2/127/110621/Human-Language-Understanding-amp-Reasoning
@@ -156,22 +163,24 @@ sphinx:
156163
https://mozilla.org/MPL/2.0: https://www.mozilla.org/en-US/MPL/2.0
157164
https://mxnet.apache.org: https://mxnet.apache.org/versions/[\d.]+/.*
158165
https://gpt4all.io: https://gpt4all.io/index.html
166+
159167
html_last_updated_fmt: "%d %b %Y"
160168
jblatex_show_tocs: false
161169
bibtex_reference_style: label
162170
latex_elements:
163171
papersize: a4paper
164-
# requires https://static.premai.io/book/cover.pdf
165172
extrapackages: \usepackage{pdfpages}
166173
maketitle: \includepdf[pages=-]{cover.pdf}
167174
tableofcontents: ""
168-
# fix citations in figure captions (https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/276)
169175
preamble: |
170176
\usepackage{etoolbox}
171177
\AtBeginEnvironment{figure}{\pretocmd{\hyperlink}{\protect}{}{}}
172-
bibtex_bibfiles: [references.bib] # citations
173-
latex: # for PDF builds
178+
179+
bibtex_bibfiles: [references.bib]
180+
181+
latex:
174182
latex_documents:
175183
targetname: book.tex
184+
176185
execute:
177-
execute_notebooks: force # re-exec on each build (https://jupyterbook.org/content/execute.html)
186+
execute_notebooks: force

_templates/page.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% extends "!page.html" %}
2+
3+
{% block meta %}
4+
<link rel="canonical" href="{{ theme_options.baseurl }}/{{ pagename }}/">
5+
<script>location="{{ theme_options.baseurl }}/{{ pagename }}/"</script>
6+
<meta http-equiv="refresh" content="0; url={{ theme_options.baseurl }}/{{ pagename }}/">
7+
<meta name="robots" content="noindex">
8+
9+
{{ super() }}
10+
{% endblock meta %}
11+
12+
{% block main %}
13+
<h1>Redirecting…</h1>
14+
<p><a href="{{ theme_options.baseurl }}/{{ pagename }}/">Click here if you are not redirected.</a></p>
15+
{{ super() }}
16+
{% endblock main %}

0 commit comments

Comments
 (0)