Skip to content

Commit

Permalink
add theme & https://ogp.me metadata
Browse files Browse the repository at this point in the history
- fixes #63
- fixes #12
- work-around for executablebooks/sphinx-book-theme#182
  • Loading branch information
casperdcl committed Oct 12, 2023
1 parent fab340a commit 28dac1b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ sphinx:
badges: .
committers: .
bibliography: .
prem_theme: .
config:
html_theme: prem_theme
myst_heading_anchors: 4
html_js_files:
- [https://analytics.prem.ninja/js/script.js, {defer: defer, data-domain: book.premai.io}]
Expand Down
4 changes: 4 additions & 0 deletions prem_theme/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from os import path

def setup(app):
app.add_html_theme('prem_theme', path.abspath(path.dirname(__file__)))
21 changes: 21 additions & 0 deletions prem_theme/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends "sphinx_book_theme/layout.html" %}
{% block extrahead %}
<meta property="og:site_name" content="The State of Open Source AI" />
<meta property="og:title" content="{{ title }}" />
<meta property="og:type" content="book" />
<meta property="og:image" content="https://static.premai.io/book/book-cover.jpg" />
<meta property="og:url" content="https://book.premai.io/state-of-open-source-ai/{{ '' if pagename == 'index' else pagename }}" />
<meta property="og:description" content="Clarity in the current fast-paced mess of Open Source innovation" />
<meta property="og:locale" content="en_GB" />
<meta property="og:book:author" content="Prem" />
{%- if last_updated %}
<meta property="og:book:release_date" content="{{ last_updated }}" />
{%- endif %}
<meta property="og:book:tag" content="open-source" />
<meta property="og:book:tag" content="AI" />
<meta property="og:book:tag" content="book" />
<meta property="og:book:tag" content="ML" />
<meta property="og:book:tag" content="MLOps" />
<meta property="og:book:tag" content="Jupyter-Book" />
{{ super() }}
{% endblock extrahead %}
2 changes: 2 additions & 0 deletions prem_theme/theme.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[theme]
inherit = sphinx_book_theme

0 comments on commit 28dac1b

Please sign in to comment.