From bf4d8a336aa4f007589dda6e01c8137640038f47 Mon Sep 17 00:00:00 2001 From: reuixiy Date: Tue, 13 Aug 2019 22:42:01 +0800 Subject: [PATCH] feat: add back to top support --- assets/scss/_common/back-to-top.scss | 7 +++++++ assets/scss/main.scss | 4 ++++ data/SVG.toml | 1 + layouts/_default/baseof.html | 1 + layouts/partials/back-to-top.html | 3 +++ 5 files changed, 16 insertions(+) create mode 100644 assets/scss/_common/back-to-top.scss create mode 100644 layouts/partials/back-to-top.html diff --git a/assets/scss/_common/back-to-top.scss b/assets/scss/_common/back-to-top.scss new file mode 100644 index 00000000..2458281e --- /dev/null +++ b/assets/scss/_common/back-to-top.scss @@ -0,0 +1,7 @@ +.back-to-top { + font-size: 90%; + color: var(--color-contrast-medium); + position: fixed; + bottom: 1em; + right: 1em; +} \ No newline at end of file diff --git a/assets/scss/main.scss b/assets/scss/main.scss index 4e787c9f..7aad0ea2 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -280,6 +280,10 @@ } {{ end }} +{{ if .Site.Params.enableBackToTop }} + @import "_common/back-to-top.scss"; +{{ end }} + {{ if .Site.Params.enableFooter }} @import "_common/footer.scss"; {{ with .Site.Params.iconColor }} diff --git a/data/SVG.toml b/data/SVG.toml index e5acf834..299229e6 100644 --- a/data/SVG.toml +++ b/data/SVG.toml @@ -25,6 +25,7 @@ code-branch = ' diff --git a/layouts/partials/back-to-top.html b/layouts/partials/back-to-top.html new file mode 100644 index 00000000..49185200 --- /dev/null +++ b/layouts/partials/back-to-top.html @@ -0,0 +1,3 @@ +{{ if or (and .IsHome .Site.Params.displayBackToTopInHome) (and (not .IsHome) .Site.Params.enableBackToTop) }} + {{ index .Site.Data.SVG .Site.Params.backToTopIcon | safeHTML }} +{{ end }} \ No newline at end of file