Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/g1eny0ung/hugo-theme-dream.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYue Yang <g1enyy0ung@gmail.com>2021-04-19 11:12:18 +0300
committerYue Yang <g1enyy0ung@gmail.com>2021-04-19 11:12:18 +0300
commit92b61d47e4b0294cdb3dba1fcdea27ebba67667c (patch)
tree78559dc09f809b367e4a3ace69d9f544ae41749e
parentdc1120227f6333dcc10d8b59855a7a3b7031a9a1 (diff)
Add param shareInAside
-rw-r--r--docs/params-configurations.md5
-rwxr-xr-xexampleSite/config.toml1
-rw-r--r--layouts/_default/single.html16
-rw-r--r--layouts/partials/share1.html14
4 files changed, 35 insertions, 1 deletions
diff --git a/docs/params-configurations.md b/docs/params-configurations.md
index 1d6f16a..22f69e8 100644
--- a/docs/params-configurations.md
+++ b/docs/params-configurations.md
@@ -64,6 +64,7 @@
showSummaryCoverInPost = true
# hasTwitterEmbed = true
# reversePostAndAside = true
+ # shareInAside = true
[params.advanced]
customCSS = ["css/custom.css"]
@@ -252,6 +253,10 @@ After setting this, you can safely remove the async script in the generated code
Reverse the position of the post content and its aside.
+### shareInAside = true
+
+Display share buttons in aside, not under the post title.
+
## Advanced
> Note: generally, the following advanced parameters are not necessary to be set. Their main purpose is to further customize the entire theme.
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 36df656..259b8df 100755
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -71,6 +71,7 @@ theme = "hugo-theme-dream"
# showSummaryCoverInPost = true
# hasTwitterEmbed = true
# reversePostAndAside = true
+ # shareInAside = true
# [params.advanced]
# customCSS = ["css/custom.css"]
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 248f5c9..9661413 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -19,11 +19,23 @@
{{ define "main" }}
<div class="ui relaxed centered grid dream-grid dream-grid-single"{{ if .Site.Params.reversePostAndAside }}style="flex-direction: row-reverse;"{{ end }}>
<!-- len <nav id="TableOfContents"></nav> == 32 -->
- {{ if ge (len .TableOfContents) 33 }}
+ {{ $showTOC := ge (len .TableOfContents) 33 }}
+ {{ $shareInAside := .Site.Params.shareInAside }}
+ {{ $showAside := or $showTOC $shareInAside }}
+
+ {{ if $showAside }}
<aside class="sixteen wide mobile sixteen wide tablet three wide computer column dream-single-aside">
+ {{ end }}
+ {{ if $showTOC }}
<div class="ui segment toc">
{{ .TableOfContents }}
</div>
+ {{ end }}
+
+ {{ if $shareInAside }}
+ {{ partial "share1.html" . }}
+ {{ end }}
+ {{ if $showAside }}
</aside>
{{ end }}
<div class="sixteen wide mobile sixteen wide tablet ten wide computer column markdown-body dream-single" id="dream-save-post-as-img">
@@ -78,7 +90,9 @@
{{ end }}
</div>
+ {{ if not $shareInAside }}
{{ partial "share.html" . }}
+ {{ end }}
</div>
</h1>
</header>
diff --git a/layouts/partials/share1.html b/layouts/partials/share1.html
new file mode 100644
index 0000000..eb3c87d
--- /dev/null
+++ b/layouts/partials/share1.html
@@ -0,0 +1,14 @@
+<div class="ui segment">
+ <button
+ class="ui circular icon button save-as-image"
+ title="{{ i18n "saveAsImage" }}"
+ onclick="savePostAsImg()">
+ <i class="save icon"></i>
+ </button>
+ <a href="https://twitter.com/intent/tweet?text={{ .Title }}&url={{ .Permalink }}" class="ui circular twitter icon button">
+ <i class="twitter icon"></i>
+ </a>
+ <a href="https://facebook.com/sharer/sharer.php?u={{ .Permalink }}" class="ui circular facebook icon button">
+ <i class="facebook icon"></i>
+ </a>
+</div>