Add a feature to auto-detect newer iterations of a post.

This commit is contained in:
Anna Rose 2024-07-03 16:00:33 +00:00
parent 0277890db3
commit 919a0cf7ed
3 changed files with 21 additions and 2 deletions

View File

@ -1,6 +1,7 @@
--- ---
title: "Choosing a Starter Ship in Star Citizen" title: "Choosing a Starter Ship in Star Citizen"
date: 2023-11-27 date: 2023-11-27
versioned: star-citizen-starter-guide
tags: tags:
- video games - video games
- game guide - game guide

View File

@ -1,8 +1,18 @@
{{ partial "menu.html" . }} {{ partial "menu.html" . }}
{{ with ($.Param "deprecated") }} {{ if ($.Param "deprecated") }}
<p class="l-deprecation_warning"> <p class="l-deprecation_warning">
This post was saved / ported from a previous site migration. You may This post was saved / ported from a previous site migration. You may
encounter missing images, dead links, and strange formatting. Sorry encounter missing images, dead links, and strange formatting. Sorry
about that! about that!
</p> </p>
{{ end }} {{ end }}
{{ if .Param "versioned" }}
{{ range (where (where .Site.RegularPages "Type" "posts") "Params.versioned" (.Param "versioned")).Limit 1 }}
{{ if not (eq .Slug $.Slug) }}
<p class="l-new_version_message">
There is a newer version of this post available, published on {{.Date | time.Format .Site.Params.dateFormat}}. <a href="{{.RelPermalink}}">Click here</a> to read the latest version.
</p>
{{ end }}
{{end }}
{{ end }}

View File

@ -29,7 +29,15 @@ figcaption {
} }
.l-deprecation_warning { .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; text-align: center;
width: 96%; width: 96%;
max-width: 720px; max-width: 720px;