Add descriptive page titles and social link-preview (Open Graph) metadata#824
Open
GHPBZ wants to merge 1 commit into
Open
Add descriptive page titles and social link-preview (Open Graph) metadata#824GHPBZ wants to merge 1 commit into
GHPBZ wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Gives dataset, tool/pipeline, and experiment pages their own browser title and
their own social link-preview, and replaces the site's placeholder meta
description with a real one.
<title>CONP Portal | Dataset</title>for every dataset. It now shows thedataset's own title (
CONP Portal | {{ data.title }}), matching what the tooland experiment pages already do. Closes More descriptive browser page titles for the Portal #754.
base_main.htmlpreviously shipped onlya Twitter Card with a single site-wide title. Added standard Open Graph tags
(
og:type,og:site_name,og:title,og:description,og:image,og:url) so that pasting a CONP link into Slack, Teams, Bluesky, LinkedIn,Mastodon, iMessage, or a document produces a real preview. Dataset, pipeline,
and experiment pages override
og:title/og:description(datasets alsoog:url) so each has its own card. The Twitter Card tags now mirror the OpenGraph values so the two never drift.
<meta name="description" content="CONP">is now aone-sentence description of the Portal (this is the text search engines show).
twitter:siteis set to the CONP Bluesky handle@CONP_PCNO (was
@NeuroLibre). Bluesky itself builds link cards from theOpen Graph tags above; the handle tag is kept for X/Twitter attribution.
How it works
The social values are overridable Jinja blocks in
base_main.html(
meta_description,og_title,og_description,og_image,og_url). Pagesthat know their subject override the relevant blocks; every other page falls back
to site-wide defaults. The Twitter tags render from the same blocks via
self.og_title()etc. All per-page values have fallbacks, and dataset/tooldescriptions are passed through
striptags | truncate(200)for a clean card.Files
app/templates/common/base_main.html— meta description; Open Graph + mirroredTwitter tags as overridable blocks;
twitter:siteset to@CONP_PCNO.app/templates/dataset.html— per-dataset<title>; og overrides.app/templates/pipeline.html— og overrides.app/templates/experiments/experiment.html— og overrides.Templates only; no route, model, dependency, or build changes.
Testing
Open Graph and mirrored Twitter tags, that HTML in descriptions is stripped and
escaped, and that the missing-title / missing-description fallbacks fire.
Possible follow-up
og:imageis the site-wide CONP card on every page. Per-dataset images (via theexisting
/dataset_logoendpoint) are a natural follow-up but were left out herebecause dataset logos vary in size/availability and could produce broken cards.