Skip to content

Commit e016658

Browse files
authored
refactor: Reorganize Cookbook structure and add JSON-LD metadata injection (#153)
1 parent 193b1b6 commit e016658

20 files changed

Lines changed: 2084 additions & 51016 deletions

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ jobs:
3535
- name: Install Dependencies
3636
run: |
3737
python -m pip install --upgrade pip
38-
pip install -r requirements.txt
38+
pip install -r src/requirements.txt
3939
4040
- name: Build Jupyter Book HTML
4141
run: |
42-
jupyter-book build .
42+
jupyter-book build src/
4343
4444
- name: Setup Pages
4545
uses: actions/configure-pages@v5

_config.yml renamed to src/_config.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Book settings
2-
32
title: Scholarly API Cookbook
43
author: The University of Alabama Libraries
5-
copyright: "2025"
4+
copyright: "2026"
65
logo: images/UALIB_logo.png
7-
exclude_patterns: [readme.md, old, conversion_scripts]
6+
exclude_patterns:
7+
- readme.md
8+
- old
9+
- conversion_scripts
10+
811
# Force re-execution of notebooks on each build.
912
# See https://jupyterbook.org/content/execute.html
1013
execute:
@@ -16,13 +19,13 @@ latex:
1619
targetname: book.tex
1720

1821
# Add a bibtex file so that we can create citations
19-
#bibtex_bibfiles:
20-
# - references.bib
22+
# bibtex_bibfiles:
23+
# - references.bib
2124

2225
# Information about where the book exists on the web
2326
repository:
2427
url: https://github.com/UA-Libraries-Research-Data-Services/UALIB_ScholarlyAPI_Cookbook # Online location of your book
25-
# path_to_book: # Optional path to your book, relative to the repository root
28+
path_to_book: src/ # Optional path to your book, relative to the repository root
2629
branch: main # Which branch of the repository should be used when creating links (optional)
2730

2831
# Add GitHub buttons to your book
@@ -36,3 +39,9 @@ launch_buttons:
3639
colab_url: ""
3740
binderhub_url: ""
3841
jupyterhub_url: ""
42+
43+
sphinx:
44+
config:
45+
templates_path:
46+
- _templates
47+
html_basepath: https://ua-libraries-research-data-services.github.io/UALIB_ScholarlyAPI_Cookbook/

src/_templates/layout.html

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{% extends "!layout.html" %}
2+
3+
{%- block extrahead %}
4+
{{ super() }}
5+
6+
<script type="application/ld+json">
7+
{
8+
"@context": "https://schema.org",
9+
"@graph": [
10+
{
11+
"@type": "Organization",
12+
"@id": "{{ html_baseurl }}#org-ua",
13+
"name": "The University of Alabama",
14+
"alternateName": ["UA"],
15+
"url": "https://www.ua.edu/",
16+
"sameAs": [
17+
"https://en.wikipedia.org/wiki/University_of_Alabama"
18+
]
19+
"subOrganization": {
20+
"@type": "Organization",
21+
"@id": "{{ html_baseurl }}#org-ua-libraries",
22+
"name": "The University of Alabama Libraries",
23+
"alternateName": [
24+
"UA Libraries",
25+
"UALIB",
26+
"University of Alabama Libraries",
27+
"University Libraries"
28+
],
29+
"url": "https://www.lib.ua.edu/",
30+
"subOrganization": [
31+
{
32+
"@type": "Organization",
33+
"@id": "{{ html_baseurl }}#org-rds",
34+
"name": "Research Data Services",
35+
"alternateName": ["RDS"],
36+
"url": "https://guides.lib.ua.edu/rds/"
37+
},
38+
{
39+
"@type": "Organization",
40+
"@id": "{{ html_baseurl }}#org-rcs",
41+
"name": "Research Computing Services",
42+
"alternateName": ["RCS"],
43+
"url": "https://guides.lib.ua.edu/RCS/"
44+
}
45+
]
46+
}
47+
},
48+
{
49+
"@type": "WebSite",
50+
"@id": "{{ html_baseurl }}#website",
51+
"name": "University of Alabama Libraries Scholarly API Cookbook",
52+
"url": "{{ html_baseurl }}",
53+
"publisher": {
54+
"@id": "{{ html_baseurl }}#org-ua-libraries"
55+
},
56+
"logo": {
57+
"@type": "ImageObject",
58+
"url": "{{ html_baseurl }}images/script-a-icon.png"
59+
}
60+
},
61+
{
62+
"@type": "WebPage",
63+
"@id": {{ (html_baseurl ~ pathto(pagename, 1) ~ "#webpage") | tojson }},
64+
"name": {{ title | striptags | tojson }},
65+
"url": {{ (html_baseurl ~ pathto(pagename, 1)) | tojson }},
66+
"isPartOf": { "@id": "{{html_baseurl}}#website" },
67+
"publisher": { "@id": "{{html_baseurl}}#org-ua-libraries" }
68+
}
69+
]
70+
}
71+
</script>
72+
73+
{%- endblock %}

0 commit comments

Comments
 (0)