Add a download page for preview builds (#640)

- Make downloads data-driven, create a database of versions;
- Add a custom plugin to generate download URLs;
- Use the new plugin for the regular downloads page as well.
This commit is contained in:
Yuri Sizov
2023-05-17 20:36:53 +02:00
committed by GitHub
parent 7e9a8a59b8
commit 5c406d2903
50 changed files with 1403 additions and 601 deletions

View File

@@ -1,10 +1,17 @@
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
# Articles that have a date older than this at build time
# are considered outdated.
#
# See also `_includes/outdated_article_notice.html`.
AVERAGE_SECONDS_PER_MONTH = 2628000
OUTDATED_THRESHOLD_IN_MONTHS = 18
Jekyll::Hooks.register :site, :after_init do |site|
# We use `site.time` that holds the build time as a base.
# As we can't do math directly in the article template, we
# prepare a value that we can compare to instead.
threshold = site.time - AVERAGE_SECONDS_PER_MONTH * OUTDATED_THRESHOLD_IN_MONTHS
site.config["outdated_article_threshold"] = threshold
end