|
3 | 3 | {%- block extrahead %} |
4 | 4 | {{ super() }} |
5 | 5 |
|
| 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 --> |
6 | 30 | <script type="application/ld+json"> |
7 | 31 | { |
8 | 32 | "@context": "https://schema.org", |
9 | 33 | "@graph": [ |
10 | 34 | { |
11 | 35 | "@type": "Organization", |
12 | | - "@id": "{{ html_baseurl }}#org-ua", |
| 36 | + "@id": "{{ base }}#org-ua", |
13 | 37 | "name": "The University of Alabama", |
14 | | - "alternateName": ["UA"], |
| 38 | + "alternateName": ["UA", "Bama"], |
15 | 39 | "url": "https://www.ua.edu/", |
16 | 40 | "sameAs": [ |
17 | 41 | "https://en.wikipedia.org/wiki/University_of_Alabama" |
18 | | - ] |
| 42 | + ], |
19 | 43 | "subOrganization": { |
20 | 44 | "@type": "Organization", |
21 | | - "@id": "{{ html_baseurl }}#org-ua-libraries", |
| 45 | + "@id": "{{ base }}#org-ua-libraries", |
22 | 46 | "name": "The University of Alabama Libraries", |
23 | 47 | "alternateName": [ |
24 | 48 | "UA Libraries", |
|
30 | 54 | "subOrganization": [ |
31 | 55 | { |
32 | 56 | "@type": "Organization", |
33 | | - "@id": "{{ html_baseurl }}#org-rds", |
| 57 | + "@id": "{{ base }}#org-rds", |
34 | 58 | "name": "Research Data Services", |
35 | 59 | "alternateName": ["RDS"], |
36 | 60 | "url": "https://guides.lib.ua.edu/rds/" |
37 | 61 | }, |
38 | 62 | { |
39 | 63 | "@type": "Organization", |
40 | | - "@id": "{{ html_baseurl }}#org-rcs", |
| 64 | + "@id": "{{ base }}#org-rcs", |
41 | 65 | "name": "Research Computing Services", |
42 | 66 | "alternateName": ["RCS"], |
43 | 67 | "url": "https://guides.lib.ua.edu/RCS/" |
|
47 | 71 | }, |
48 | 72 | { |
49 | 73 | "@type": "WebSite", |
50 | | - "@id": "{{ html_baseurl }}#website", |
| 74 | + "@id": "{{ base }}#website", |
51 | 75 | "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 }}", |
53 | 85 | "publisher": { |
54 | | - "@id": "{{ html_baseurl }}#org-ua-libraries" |
| 86 | + "@id": "{{ base }}#org-ua-libraries" |
55 | 87 | }, |
56 | 88 | "logo": { |
57 | 89 | "@type": "ImageObject", |
58 | | - "url": "{{ html_baseurl }}images/script-a-icon.png" |
| 90 | + "url": "{{ base }}images/script-a-icon.png" |
59 | 91 | } |
60 | 92 | }, |
61 | 93 | { |
62 | 94 | "@type": "WebPage", |
63 | | - "@id": {{ (html_baseurl ~ pathto(pagename, 1) ~ "#webpage") | tojson }}, |
| 95 | + "@id": {{ page_url ~ "#webpage" | tojson }}, |
64 | 96 | "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" } |
68 | 101 | } |
69 | 102 | ] |
70 | 103 | } |
|
0 commit comments