From ad56241fc33c89bf2dabb22fa224f37ae088e1e5 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Sun, 5 Jan 2025 23:30:31 -0800 Subject: [PATCH] Fix `back_to_top` not displaying when no other footer variables are set (#1461) This is the minimum necessary change to make `back_to_top` work when there is no custom footer, last edit timestamp, or GitHub edit link. Two immediate thoughts. First, we have a pair of variables: `back_to_top` and `back_to_top_text`. In my opinion, this seems a bit unnecessary; we could just use a `back_to_top`, and treat any non-`nil`/`false` value as the text. We could make this backwards compatible (i.e. support but deprecate `back_to_top_text`). Any thoughts here? Secondly, some of these conditions are weak: https://github.com/just-the-docs/just-the-docs/blob/a251382b7a68acb4eff37774b31750550809cf1f/_includes/components/footer.html#L7-L9 Here, this conditional *should* also check for `back_to_top_text`, and presumably, this should "bubble up" to the overall `if` statement on line 4 (similar things for the `gh_*` variables - the line 4 condition only checks for `gh_edit_link`). Is this a reasonable concern/take? If so, I can approach this some time (either in this PR, in another PR, etc.). --- After we decide the correct behaviour of `back_to_top`, I'll add documentation to the "Configuration" section! Separately, @pdmosses mentioned: > The obvious fix is to always render the footer when `site.back_to_top` is set. However, it would improve the usability of the back-to-top feature if individual pages could override the site setting (to suppress the link on some short pages, or to show it on some long pages). Happy to do that too - for organizational purposes, I'll punt that to another PR (that I can merge into the same release). --- Fixes #1443. --- CHANGELOG.md | 4 +++- _includes/components/footer.html | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de0a061..1c1408f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,12 +17,14 @@ This website is built from the `HEAD` of the `main` branch of the theme reposito Code changes to `main` that are *not* in the latest release: -- N/A +- Fixed: `back_to_top` not displaying when no other footer variables are set by [@mattxwang] in [#1461] Docs changes made since the latest release: - N/A +[#1461]: https://github.com/just-the-docs/just-the-docs/pull/1461 + ## Release v0.10.0 Hi folks! This minor release adds one of our most-requested features: unlimited multi-level navigation (also known as recursive navigation). Huge thanks to [@pdmosses] for his wonderful work in implementing this feature! diff --git a/_includes/components/footer.html b/_includes/components/footer.html index 01b2c23..6200cbf 100644 --- a/_includes/components/footer.html +++ b/_includes/components/footer.html @@ -1,7 +1,7 @@ {% capture footer_custom %} {%- include footer_custom.html -%} {% endcapture %} -{% if footer_custom != "" or site.last_edit_timestamp or site.gh_edit_link %} +{% if footer_custom != "" or site.last_edit_timestamp or site.gh_edit_link or site.back_to_top %}