From 919a0cf7ed2bfc5502eab9e5bfa1b9cce6cd8c49 Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Wed, 3 Jul 2024 16:00:33 +0000 Subject: [PATCH] Add a feature to auto-detect newer iterations of a post. --- .../index.md | 1 + layouts/partials/header_custom.html | 12 +++++++++++- static/css/custom.css | 10 +++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/content/posts/2023-11-27-choosing-a-starter-ship-in-star-citizen/index.md b/content/posts/2023-11-27-choosing-a-starter-ship-in-star-citizen/index.md index 4c40ef1..0827551 100644 --- a/content/posts/2023-11-27-choosing-a-starter-ship-in-star-citizen/index.md +++ b/content/posts/2023-11-27-choosing-a-starter-ship-in-star-citizen/index.md @@ -1,6 +1,7 @@ --- title: "Choosing a Starter Ship in Star Citizen" date: 2023-11-27 +versioned: star-citizen-starter-guide tags: - video games - game guide diff --git a/layouts/partials/header_custom.html b/layouts/partials/header_custom.html index 28d847d..5cdf34b 100644 --- a/layouts/partials/header_custom.html +++ b/layouts/partials/header_custom.html @@ -1,8 +1,18 @@ {{ partial "menu.html" . }} -{{ with ($.Param "deprecated") }} +{{ if ($.Param "deprecated") }}

This post was saved / ported from a previous site migration. You may encounter missing images, dead links, and strange formatting. Sorry about that!

{{ end }} + +{{ if .Param "versioned" }} + {{ range (where (where .Site.RegularPages "Type" "posts") "Params.versioned" (.Param "versioned")).Limit 1 }} + {{ if not (eq .Slug $.Slug) }} +

+ There is a newer version of this post available, published on {{.Date | time.Format .Site.Params.dateFormat}}. Click here to read the latest version. +

+ {{ end }} + {{end }} +{{ end }} diff --git a/static/css/custom.css b/static/css/custom.css index 707cb19..c96caa7 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -29,7 +29,15 @@ figcaption { } .l-deprecation_warning { - background-color: #dd4444; + background-color: #ff6666; + text-align: center; + width: 96%; + max-width: 720px; + margin: 20px auto 10px; +} + +.l-new_version_message { + background-color: #dddd66; text-align: center; width: 96%; max-width: 720px;