Skip to content

Commit 8383995

Browse files
authored
Merge pull request #157 from UA-Libraries-Research-Data-Services/update-site-metadata
Update site metadata
2 parents 070d818 + 90d68ab commit 8383995

5 files changed

Lines changed: 70 additions & 14 deletions

File tree

src/_config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ launch_buttons:
4141
jupyterhub_url: ""
4242

4343
sphinx:
44+
extra_extensions:
45+
- sphinx_sitemap
46+
- sphinx-last-updated-by-git
4447
config:
4548
templates_path:
4649
- _templates
4750
html_baseurl: https://ua-libraries-research-data-services.github.io/UALIB_ScholarlyAPI_Cookbook/
51+
html_context:
52+
html_baseurl: https://ua-libraries-research-data-services.github.io/UALIB_ScholarlyAPI_Cookbook/
53+
sitemap_url_scheme: "{link}"

src/_templates/layout.html

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,46 @@
33
{%- block extrahead %}
44
{{ super() }}
55

6+
{% set site_name = "University of Alabama Libraries Scholarly API Cookbook" %}
7+
{% set base = (html_baseurl or "https://ua-libraries-research-data-services.github.io/UALIB_ScholarlyAPI_Cookbook/") %}
8+
{% set page_url = base ~ pagename ~ ('' if pagename.endswith('.html') else '.html') %}
9+
10+
{# Prefer page description; fallback to a global site description #}
11+
{% set site_desc = "Example tutorials for working with scholarly APIs for academic scholarly research and teaching using Python and R." %}
12+
{% set page_desc = meta.get("description") if meta is defined else None %}
13+
{% set desc = page_desc or site_desc %}
14+
15+
{# Allow per-page overrides for social #}
16+
{% set og_title = (meta.get("og:title") if meta is defined else None) or (title|striptags) %}
17+
{% set og_type = (meta.get("og:type") if meta is defined else None) or "website" %}
18+
19+
<!-- Canonical Link -->
20+
<link rel="canonical" href="{{ page_url }}" />
21+
22+
<!-- Open Graph -->
23+
<meta property="og:site_name" content="{{ site_name }}" />
24+
<meta property="og:title" content="{{ og_title }}" />
25+
<meta property="og:description" content="{{ desc }}" />
26+
<meta property="og:type" content="{{ og_type }}" />
27+
<meta property="og:url" content="{{ page_url }}" />
28+
29+
<!-- LD+JSON -->
630
<script type="application/ld+json">
731
{
832
"@context": "https://schema.org",
933
"@graph": [
1034
{
1135
"@type": "Organization",
12-
"@id": "{{ html_baseurl }}#org-ua",
36+
"@id": "{{ base }}#org-ua",
1337
"name": "The University of Alabama",
14-
"alternateName": ["UA"],
38+
"alternateName": ["UA", "Bama"],
1539
"url": "https://www.ua.edu/",
1640
"sameAs": [
1741
"https://en.wikipedia.org/wiki/University_of_Alabama"
18-
]
42+
],
1943
"subOrganization": {
2044
"@type": "Organization",
21-
"@id": "{{ html_baseurl }}#org-ua-libraries",
45+
"@id": "{{ base }}#org-ua-libraries",
2246
"name": "The University of Alabama Libraries",
2347
"alternateName": [
2448
"UA Libraries",
@@ -30,14 +54,14 @@
3054
"subOrganization": [
3155
{
3256
"@type": "Organization",
33-
"@id": "{{ html_baseurl }}#org-rds",
57+
"@id": "{{ base }}#org-rds",
3458
"name": "Research Data Services",
3559
"alternateName": ["RDS"],
3660
"url": "https://guides.lib.ua.edu/rds/"
3761
},
3862
{
3963
"@type": "Organization",
40-
"@id": "{{ html_baseurl }}#org-rcs",
64+
"@id": "{{ base }}#org-rcs",
4165
"name": "Research Computing Services",
4266
"alternateName": ["RCS"],
4367
"url": "https://guides.lib.ua.edu/RCS/"
@@ -47,24 +71,33 @@
4771
},
4872
{
4973
"@type": "WebSite",
50-
"@id": "{{ html_baseurl }}#website",
74+
"@id": "{{ base }}#website",
5175
"name": "University of Alabama Libraries Scholarly API Cookbook",
52-
"url": "{{ html_baseurl }}",
76+
"alternateName": [
77+
"UA Libraries Scholarly API Cookbook",
78+
"University Libraries Scholarly API Cookbook",
79+
"UALIB Scholarly API Cookbook",
80+
"Scholarly API Cookbook",
81+
"Scholarly API Guide"
82+
],
83+
"description": "{{ site_desc }}",
84+
"url": "{{ base }}",
5385
"publisher": {
54-
"@id": "{{ html_baseurl }}#org-ua-libraries"
86+
"@id": "{{ base }}#org-ua-libraries"
5587
},
5688
"logo": {
5789
"@type": "ImageObject",
58-
"url": "{{ html_baseurl }}images/script-a-icon.png"
90+
"url": "{{ base }}images/script-a-icon.png"
5991
}
6092
},
6193
{
6294
"@type": "WebPage",
63-
"@id": {{ (html_baseurl ~ pathto(pagename, 1) ~ "#webpage") | tojson }},
95+
"@id": {{ page_url ~ "#webpage" | tojson }},
6496
"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" }
97+
"url": {{ page_url | to_json }},
98+
"dateModified": "{{ last_updated | tojson }}",
99+
"isPartOf": { "@id": "{{ base }}#website" },
100+
"publisher": { "@id": "{{ base }}#org-ua-libraries" }
68101
}
69102
]
70103
}

src/about/introduction.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. meta::
2+
:title: Scholarly API Cookbook Introduction
3+
:og:type: article
4+
15
Introduction
26
%%%%%%%%%%%%%%
37

src/python/chronam.ipynb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"---\n",
8+
"title: Chronicling America API in Python\n",
9+
"description: Tutorial for using the Chronicling America API with Python including use cases\n",
10+
"og:type: article\n",
11+
"---"
12+
]
13+
},
314
{
415
"cell_type": "markdown",
516
"metadata": {

src/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
jupyter-book<2
22
matplotlib
33
numpy
4+
sphinx-sitemap
5+
sphinx-last-updated-by-git

0 commit comments

Comments
 (0)