|
3 | 3 | {%- block extrahead %} |
4 | 4 | {{ super() }} |
5 | 5 |
|
| 6 | + {% set site_name = "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 = "Practical tutorials and examples for working with scholarly APIs, research metadata, and reproducible data workflows 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 | + {% set og_image = (meta.get("og:image") if meta is defined else None) %} |
| 19 | + |
| 20 | + {% set tw_card = (meta.get("twitter:card") if meta is defined else None) or "summary" %} |
| 21 | + {% set tw_image = (meta.get("twitter:image") if meta is defined else None) or og_image %} |
| 22 | + |
| 23 | + <!-- Canonical Link --> |
| 24 | + <link rel="canonical" href="{{ page_url }}" /> |
| 25 | + |
| 26 | + <!-- Open Graph --> |
| 27 | + <meta property="og:site_name" content="{{ site_name }}" /> |
| 28 | + <meta property="og:title" content="{{ og_title }}" /> |
| 29 | + <meta property="og:description" content="{{ desc }}" /> |
| 30 | + <meta property="og:type" content="{{ og_type }}" /> |
| 31 | + <meta property="og:url" content="{{ page_url }}" /> |
| 32 | + |
| 33 | + <!-- Twitter Card --> |
| 34 | + <meta name="twitter:card" content="{{ tw_card }}" /> |
| 35 | + <meta name="twitter:title" content="{{ og_title }}" /> |
| 36 | + <meta name="twitter:description" content="{{ desc }}" /> |
| 37 | + |
| 38 | + <!-- LD+JSON --> |
6 | 39 | <script type="application/ld+json"> |
7 | 40 | { |
8 | 41 | "@context": "https://schema.org", |
9 | 42 | "@graph": [ |
10 | 43 | { |
11 | 44 | "@type": "Organization", |
12 | | - "@id": "{{ html_baseurl }}#org-ua", |
| 45 | + "@id": "{{ base }}#org-ua", |
13 | 46 | "name": "The University of Alabama", |
14 | | - "alternateName": ["UA"], |
| 47 | + "alternateName": ["UA", "Bama"], |
15 | 48 | "url": "https://www.ua.edu/", |
16 | 49 | "sameAs": [ |
17 | 50 | "https://en.wikipedia.org/wiki/University_of_Alabama" |
18 | | - ] |
| 51 | + ], |
19 | 52 | "subOrganization": { |
20 | 53 | "@type": "Organization", |
21 | | - "@id": "{{ html_baseurl }}#org-ua-libraries", |
| 54 | + "@id": "{{ base }}#org-ua-libraries", |
22 | 55 | "name": "The University of Alabama Libraries", |
23 | 56 | "alternateName": [ |
24 | 57 | "UA Libraries", |
|
30 | 63 | "subOrganization": [ |
31 | 64 | { |
32 | 65 | "@type": "Organization", |
33 | | - "@id": "{{ html_baseurl }}#org-rds", |
| 66 | + "@id": "{{ base }}#org-rds", |
34 | 67 | "name": "Research Data Services", |
35 | 68 | "alternateName": ["RDS"], |
36 | 69 | "url": "https://guides.lib.ua.edu/rds/" |
37 | 70 | }, |
38 | 71 | { |
39 | 72 | "@type": "Organization", |
40 | | - "@id": "{{ html_baseurl }}#org-rcs", |
| 73 | + "@id": "{{ base }}#org-rcs", |
41 | 74 | "name": "Research Computing Services", |
42 | 75 | "alternateName": ["RCS"], |
43 | 76 | "url": "https://guides.lib.ua.edu/RCS/" |
|
47 | 80 | }, |
48 | 81 | { |
49 | 82 | "@type": "WebSite", |
50 | | - "@id": "{{ html_baseurl }}#website", |
| 83 | + "@id": "{{ base }}#website", |
51 | 84 | "name": "University of Alabama Libraries Scholarly API Cookbook", |
52 | | - "url": "{{ html_baseurl }}", |
| 85 | + "alternateName": [ |
| 86 | + "UA Libraries Scholarly API Cookbook", |
| 87 | + "University Libraries Scholarly API Cookbook", |
| 88 | + "UALIB Scholarly API Cookbook", |
| 89 | + "Scholarly API Cookbook", |
| 90 | + "Scholarly API Guide" |
| 91 | + ], |
| 92 | + "description": "{{ site_desc }}", |
| 93 | + "url": "{{ base }}", |
53 | 94 | "publisher": { |
54 | | - "@id": "{{ html_baseurl }}#org-ua-libraries" |
| 95 | + "@id": "{{ base }}#org-ua-libraries" |
55 | 96 | }, |
56 | 97 | "logo": { |
57 | 98 | "@type": "ImageObject", |
58 | | - "url": "{{ html_baseurl }}images/script-a-icon.png" |
| 99 | + "url": "{{ base }}images/script-a-icon.png" |
59 | 100 | } |
60 | 101 | }, |
61 | 102 | { |
62 | 103 | "@type": "WebPage", |
63 | | - "@id": {{ (html_baseurl ~ pathto(pagename, 1) ~ "#webpage") | tojson }}, |
| 104 | + "@id": {{ page_url ~ "#webpage" | tojson }}, |
64 | 105 | "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" } |
| 106 | + "url": {{ page_url | to_json }}, |
| 107 | + "dateModified": "{{ last_updated | tojson }}", |
| 108 | + "isPartOf": { "@id": "{{ base }}#website" }, |
| 109 | + "publisher": { "@id": "{{ base }}#org-ua-libraries" } |
68 | 110 | } |
69 | 111 | ] |
70 | 112 | } |
|
0 commit comments