mirror of
https://github.com/godotengine/godot-website.git
synced 2026-01-04 06:09:55 +03:00
Blog: add note for articles that might be outdated (#537)
Provides a custom `site.outdated_article_threshold` variable through a Jekyll plugin.
This commit is contained in:
10
_plugins/outdated_article_threshold.rb
Normal file
10
_plugins/outdated_article_threshold.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
AVERAGE_SECONDS_PER_MONTH = 2628000
|
||||
|
||||
# Add a custom `site.outdated_article_threshold` variable.
|
||||
# We use `site.time` that holds the build time as a base, but since you can't do math in
|
||||
# the template language we can't use it there directly.
|
||||
Jekyll::Hooks.register(:site, :after_init) do |site|
|
||||
# Articles that have a date older than this at build time are considered outdated.
|
||||
# see `_includes/outdated_article_notice.html`
|
||||
site.config["outdated_article_threshold"] = site.time - AVERAGE_SECONDS_PER_MONTH * 18
|
||||
end
|
||||
Reference in New Issue
Block a user