From 50e6777e853a67dbb7a7e2be5ee8639d5d6aa097 Mon Sep 17 00:00:00 2001 From: Jeroen Janssens Date: Wed, 15 Apr 2026 12:55:45 +0000 Subject: [PATCH] Add source-specific announcements for legacy blog redirects Show a banner when visitors arrive from a legacy blog (e.g., the Quarto or Shiny blog) informing them that posts have moved to the unified Posit Open Source blog. Announcements appear on /blog/q/* pages for no-JS users and dynamically on /blog/?q=source:* for JS users. --- assets/js/search-filter-sort.js | 23 +++++++++++++++++++++++ content/blog/q/ai/_index.md | 4 ++++ content/blog/q/education/_index.md | 4 ++++ content/blog/q/great-tables/_index.md | 4 ++++ content/blog/q/plotnine/_index.md | 4 ++++ content/blog/q/pointblank/_index.md | 4 ++++ content/blog/q/positron/_index.md | 4 ++++ content/blog/q/quarto/_index.md | 4 ++++ content/blog/q/rstudio/_index.md | 4 ++++ content/blog/q/shiny/_index.md | 4 ++++ content/blog/q/tidyverse/_index.md | 4 ++++ layouts/blog/blog-query.html | 6 ++++++ layouts/blog/list.html | 9 +++++++++ 13 files changed, 78 insertions(+) diff --git a/assets/js/search-filter-sort.js b/assets/js/search-filter-sort.js index 394142c1f..5cf674bee 100644 --- a/assets/js/search-filter-sort.js +++ b/assets/js/search-filter-sort.js @@ -367,6 +367,7 @@ const featured = this.container.parentElement?.querySelector('[data-featured]'); if (featured) featured.classList.add('hidden'); } + this._updateSourceAnnouncement(); if (this.state.showFilters || this._hasActiveFilters()) this._showControls(); this._updateShowBtnLabel(); this._bindControls(); @@ -936,6 +937,7 @@ this._updateCount(filtered.length); this._updateEmpty(filtered.length === 0); this._updateResetBtn(); + this._updateSourceAnnouncement(); this._updateURL(); if (this._interactive && this.controlsEl) { @@ -1028,6 +1030,27 @@ if (emptyEl) emptyEl.classList.toggle('hidden', !isEmpty); } + _updateSourceAnnouncement() { + const parent = this.container.parentElement; + if (!parent) return; + const announcements = parent.querySelectorAll('[data-source-announcement]'); + if (!announcements.length) return; + + // Extract source value from search query (e.g. "source:quarto" → "quarto") + const match = this.state.search.match(/\bsource:(\S+)/i); + const source = match ? match[1].toLowerCase().replace(/^"(.*)"$/, '$1') : ''; + + announcements.forEach(el => { + el.classList.toggle('hidden', el.dataset.sourceAnnouncement !== source); + }); + + // Also hide featured when a source announcement is visible + const featured = parent.querySelector('[data-featured]'); + if (featured && source) { + featured.classList.add('hidden'); + } + } + _updateURL() { const params = new URLSearchParams(); const defaultSortKey = this._defaultSortCfg ? this._defaultSortCfg.key : ''; diff --git a/content/blog/q/ai/_index.md b/content/blog/q/ai/_index.md index d16578aa0..b7eca8715 100644 --- a/content/blog/q/ai/_index.md +++ b/content/blog/q/ai/_index.md @@ -1,3 +1,7 @@ --- title: AI --- + +### The AI blog has a new home + +The AI blog has moved to the [Posit Open Source blog](/blog/). All past and future AI posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/education/_index.md b/content/blog/q/education/_index.md index 770a1f25d..4fdcfd95a 100644 --- a/content/blog/q/education/_index.md +++ b/content/blog/q/education/_index.md @@ -1,3 +1,7 @@ --- title: Education --- + +### The Education blog has a new home + +The Education blog has moved to the [Posit Open Source blog](/blog/). All past and future Education posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/great-tables/_index.md b/content/blog/q/great-tables/_index.md index 804884a02..26b952846 100644 --- a/content/blog/q/great-tables/_index.md +++ b/content/blog/q/great-tables/_index.md @@ -2,3 +2,7 @@ title: Great Tables query: "great-tables" --- + +### The Great Tables blog has a new home + +The Great Tables blog has moved to the [Posit Open Source blog](/blog/). All past and future Great Tables posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/plotnine/_index.md b/content/blog/q/plotnine/_index.md index 94fa7a968..afc3f796c 100644 --- a/content/blog/q/plotnine/_index.md +++ b/content/blog/q/plotnine/_index.md @@ -1,3 +1,7 @@ --- title: Plotnine --- + +### The Plotnine blog has a new home + +The Plotnine blog has moved to the [Posit Open Source blog](/blog/). All past and future Plotnine posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/pointblank/_index.md b/content/blog/q/pointblank/_index.md index 38bdcc010..a0b2ca9f5 100644 --- a/content/blog/q/pointblank/_index.md +++ b/content/blog/q/pointblank/_index.md @@ -1,3 +1,7 @@ --- title: Pointblank --- + +### The Pointblank blog has a new home + +The Pointblank blog has moved to the [Posit Open Source blog](/blog/). All past and future Pointblank posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/positron/_index.md b/content/blog/q/positron/_index.md index 120e5fe41..2e5a12c98 100644 --- a/content/blog/q/positron/_index.md +++ b/content/blog/q/positron/_index.md @@ -1,3 +1,7 @@ --- title: Positron --- + +### The Positron blog has a new home + +The Positron blog has moved to the [Posit Open Source blog](/blog/). All past and future Positron posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/quarto/_index.md b/content/blog/q/quarto/_index.md index 3f013c414..6e2831817 100644 --- a/content/blog/q/quarto/_index.md +++ b/content/blog/q/quarto/_index.md @@ -1,3 +1,7 @@ --- title: Quarto --- + +### The Quarto blog has a new home + +The Quarto blog has moved to the [Posit Open Source blog](/blog/). All past and future Quarto posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/rstudio/_index.md b/content/blog/q/rstudio/_index.md index 4fe4060be..c02b5ac83 100644 --- a/content/blog/q/rstudio/_index.md +++ b/content/blog/q/rstudio/_index.md @@ -1,3 +1,7 @@ --- title: RStudio --- + +### The RStudio blog has a new home + +The RStudio blog has moved to the [Posit Open Source blog](/blog/). All past and future RStudio posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/shiny/_index.md b/content/blog/q/shiny/_index.md index 35d1f6145..5c094ac1a 100644 --- a/content/blog/q/shiny/_index.md +++ b/content/blog/q/shiny/_index.md @@ -1,3 +1,7 @@ --- title: Shiny --- + +### The Shiny blog has a new home + +The Shiny blog has moved to the [Posit Open Source blog](/blog/). All past and future Shiny posts now live here alongside posts from our other open-source projects. diff --git a/content/blog/q/tidyverse/_index.md b/content/blog/q/tidyverse/_index.md index e8664fe84..368222b07 100644 --- a/content/blog/q/tidyverse/_index.md +++ b/content/blog/q/tidyverse/_index.md @@ -1,3 +1,7 @@ --- title: Tidyverse --- + +### The Tidyverse blog has a new home + +The Tidyverse blog has moved to the [Posit Open Source blog](/blog/). All past and future Tidyverse posts now live here alongside posts from our other open-source projects. diff --git a/layouts/blog/blog-query.html b/layouts/blog/blog-query.html index d4b4ccae0..461603442 100644 --- a/layouts/blog/blog-query.html +++ b/layouts/blog/blog-query.html @@ -12,6 +12,12 @@

{{ .Title }} blog posts

+ {{ with .Content }} +
+ {{ . }} +
+ {{ end }} +
{{ partial "button.html" (dict "url" "/blog/" "text" "All blog posts" "icon-left" "boxicons--chevron-left" "size" "small") }}
diff --git a/layouts/blog/list.html b/layouts/blog/list.html index 21cc00e6d..d69f736b7 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -9,6 +9,15 @@ {{ . }} {{ end }} + + {{ range (site.GetPage "/blog/q").Sections }} + {{ $source := .Params.query | default .File.ContentBaseName }} + {{ with .Content }} + + {{ end }} + {{ end }} {{ end }} {{ $baseCfg := site.Data.filters.blog }}