Skip to content

Commit 58c888b

Browse files
jolarsfradav
authored andcommitted
feat: add Open Graph and social metadata (computorg#72)
Enable `open-graph` and `twitter-card` in Quarto and add a branded 1200x630 social card so links render with an image on social media. Replace the homepage's HTML `description` (metadata-only on this page) with a plain sentence so the meta description no longer repeats the title. Also improve indexing: set `canonical-url`, drop the trailing slash from `site-url` for clean absolute URLs, and add a post-render hook to align sitemap entries with the canonical trailing-slash form. Fixes computorg#65
1 parent 91324b5 commit 58c888b

5 files changed

Lines changed: 141 additions & 4 deletions

File tree

‎_quarto.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ project:
55
- "*.qmd"
66
- "site/**/*.qmd"
77
- "blog/**/*.qmd"
8+
post-render:
9+
- scripts/fix-sitemap.sh
810
website:
911
title: COMPUTO
10-
site-url: https://computo-journal.org/
12+
site-url: https://computo-journal.org
1113
description: A platform for computational research and reproducibility
14+
image: /assets/img/og-image.png
15+
image-alt: "Computo, a journal of the French Statistical Society"
16+
open-graph:
17+
locale: en_US
18+
twitter-card:
19+
card-style: summary_large_image
1220
favicon: assets/favicon.ico
1321
navbar:
1422
background: primary
@@ -52,6 +60,7 @@ format:
5260
theme:
5361
light: [ custom.scss, light.scss ]
5462
dark: [ custom.scss, dark.scss ]
63+
canonical-url: true
5564
toc: true
5665
code-copy: true
5766
code-block-border-left: true

‎assets/img/og-image.png‎

22.6 KB
Loading

‎assets/img/og-image.svg‎

Lines changed: 112 additions & 0 deletions
Loading

‎index.qmd‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
---
2-
description: <h1>COMPUTO</h1> A journal of the <a href="https://sfds.asso.fr/">French
3-
Statistical Society <img height="10px" src="assets/img/sfds.png" alt="SFdS"/></a>
4-
- ISSN 2824-7795
2+
description: >-
3+
Computo is an open-access journal of the French Statistical Society publishing
4+
reproducible computational and algorithmic contributions in statistics and
5+
machine learning.
6+
image: assets/img/og-image.png
7+
image-alt: "Computo, a journal of the French Statistical Society"
58
page-layout: full
69
toc: false
710
listing:

‎scripts/fix-sitemap.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Quarto emits sitemap <loc> entries ending in /index.html, while pages'
5+
# rel="canonical" tags point at the trailing-slash form. Google Search Console
6+
# then flags the sitemap URLs as duplicates with no chosen canonical.
7+
# Upstream bug: https://github.com/quarto-dev/quarto-cli/discussions/11398
8+
9+
sitemap="${QUARTO_PROJECT_OUTPUT_DIR:-_site}/sitemap.xml"
10+
11+
[ -f "$sitemap" ] || exit 0
12+
13+
sed -i 's|/index\.html</loc>|/</loc>|g' "$sitemap"

0 commit comments

Comments
 (0)