From 88b21fae0afcddfa3476d12edb2b835fe548b49f Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 29 Dec 2023 13:29:34 -0800 Subject: [PATCH] Adjust deprecation handling --- content/en/contribute/documentation.md | 6 +----- content/en/methods/site/DisqusShortname.md | 5 +---- content/en/methods/site/GoogleAnalytics.md | 5 +---- content/en/methods/site/IsDevelopment.md | 9 +++++---- content/en/methods/site/IsServer.md | 9 +++++---- content/en/troubleshooting/deprecation.md | 10 +++++----- layouts/shortcodes/deprecated-in.html | 14 ++++++++++++++ 7 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 layouts/shortcodes/deprecated-in.html diff --git a/content/en/contribute/documentation.md b/content/en/contribute/documentation.md index 14df5cdee..4560a7450 100644 --- a/content/en/contribute/documentation.md +++ b/content/en/contribute/documentation.md @@ -306,13 +306,9 @@ When deprecating a function or method, add this to front matter: {{< code-toggle file=content/something/foo.md fm=true >}} expiryDate: 2024-10-30 -_build: - list: never {{< /code-toggle >}} -Set the `expiryDate` to one year from the date of deprecation, and add a brief front matter comment to explain the settings. - -Users will be able to search for the page, but the page will not appear in any list views, including section menus. +Set the `expiryDate` to one year from the date of deprecation, and add a brief front matter comment to explain the setting. ## GitHub workflow diff --git a/content/en/methods/site/DisqusShortname.md b/content/en/methods/site/DisqusShortname.md index 359b836af..2d4447485 100644 --- a/content/en/methods/site/DisqusShortname.md +++ b/content/en/methods/site/DisqusShortname.md @@ -7,10 +7,7 @@ action: related: [] returnType: string signatures: [SITE.DisqusShortname] -# deprecated 2023-10-30 -expiryDate: 2024-10-30 -_build: - list: never +expiryDate: 2024-10-30 # deprecated 2023-10-30 --- {{% deprecated-in 0.120.0 %}} diff --git a/content/en/methods/site/GoogleAnalytics.md b/content/en/methods/site/GoogleAnalytics.md index 405cf0de5..50f479b49 100644 --- a/content/en/methods/site/GoogleAnalytics.md +++ b/content/en/methods/site/GoogleAnalytics.md @@ -7,10 +7,7 @@ action: related: [] returnType: string signatures: [SITE.GoogleAnalytics] -# deprecated 2023-10-30 -expiryDate: 2024-10-30 -_build: - list: never +expiryDate: 2024-10-30 # deprecated 2023-10-30 --- {{% deprecated-in 0.120.0 %}} diff --git a/content/en/methods/site/IsDevelopment.md b/content/en/methods/site/IsDevelopment.md index fdeae15fa..c009ba0de 100644 --- a/content/en/methods/site/IsDevelopment.md +++ b/content/en/methods/site/IsDevelopment.md @@ -7,10 +7,7 @@ action: related: [] returnType: bool signatures: [SITE.IsDevelopment] -# deprecated 2023-10-30 -expiryDate: 2024-10-30 -_build: - list: never +expiryDate: 2024-10-30 # deprecated 2023-10-30 --- {{% deprecated-in 0.120.0 %}} @@ -18,3 +15,7 @@ Use [`hugo.IsDevelopment`] instead. [`hugo.IsDevelopment`]: /functions/hugo/isdevelopment {{% /deprecated-in %}} + +```go-html-template +{{ .Site.IsDevelopment }} → true/false +``` diff --git a/content/en/methods/site/IsServer.md b/content/en/methods/site/IsServer.md index c19a84bc9..3d5ce41b5 100644 --- a/content/en/methods/site/IsServer.md +++ b/content/en/methods/site/IsServer.md @@ -7,10 +7,7 @@ action: related: [] returnType: bool signatures: [SITE.IsServer] -# deprecated 2023-10-30 -expiryDate: 2024-10-30 -_build: - list: never +expiryDate: 2024-10-30 # deprecated 2023-10-30 --- {{% deprecated-in 0.120.0 %}} @@ -18,3 +15,7 @@ Use [`hugo.IsServer`] instead. [`hugo.IsServer`]: /functions/hugo/isserver {{% /deprecated-in %}} + +```go-html-template +{{ .Site.IsServer }} → true/false +``` diff --git a/content/en/troubleshooting/deprecation.md b/content/en/troubleshooting/deprecation.md index 9aef54e8a..aa4bb71a2 100644 --- a/content/en/troubleshooting/deprecation.md +++ b/content/en/troubleshooting/deprecation.md @@ -16,13 +16,13 @@ When a project _deprecates_ something, they are telling its users: 2. Use Thing Two instead. 3. We're going to remove Thing One at some point in the future. -[article]: https://en.wikipedia.org/wiki/Deprecation +[reasons for deprecation]: https://en.wikipedia.org/wiki/Deprecation -Think of deprecation as a statement of intent. This Wikipedia [article] describes common reasons for deprecation: +Common [reasons for deprecation]: -- The feature has been replaced by a more powerful alternative. -- The feature contains a design flaw. -- The feature is considered extraneous, and will be removed in the future in order to simplify the system as a whole. +- A feature has been replaced by a more powerful alternative. +- A feature contains a design flaw. +- A feature is considered extraneous, and will be removed in the future in order to simplify the system as a whole. - A future version of the software will make major structural changes, making it impossible or impractical to support older features. - Standardization or increased consistency in naming. - A feature that once was available only independently is now combined with its co-feature. diff --git a/layouts/shortcodes/deprecated-in.html b/layouts/shortcodes/deprecated-in.html new file mode 100644 index 000000000..7219d7f54 --- /dev/null +++ b/layouts/shortcodes/deprecated-in.html @@ -0,0 +1,14 @@ +{{ $_hugo_config := `{ "version": 1 }` }} + +{{ with .Get 0 }} + {{ $version := printf "v%v" (strings.TrimLeft "vV" .) }} + {{ $href := printf "https://github.com/gohugoio/hugo/releases/tag/%s" $version }} + +{{ else }} + {{ errorf "The %q shortcode requires a single positional parameter indicating version. See %s" .Name .Position }} +{{ end }}