Преглед на файлове

feat: move social share buttons below content

Also, add page_footer.html to help make page footers more consistent.

Close #1383
George Cushen преди 5 години
родител
ревизия
ec8b60f71f

+ 78 - 67
assets/sass/academic/_content.scss

@@ -103,7 +103,6 @@ article {
 /* For article page only, not lists. */
 article .article-metadata {
   margin-bottom: 20px;
-  line-height: 30px; /* Match share bar line height. */
 }
 
 .article-metadata a {
@@ -157,24 +156,6 @@ article .article-metadata {
   margin-bottom: 0;
 }
 
-.article-widget {
-  padding-top: 1rem;
-}
-
-.article-widget h3 {
-  margin-top: 0;
-}
-
-.hr-light {
-  border-top: 1px solid rgba(0,0,0,.05);
-  margin-top: 0.5rem;
-  margin-bottom: 1rem;
-}
-
-#comments {
-  padding-top: 1rem;
-}
-
 /*************************************************
  *  Publications
  **************************************************/
@@ -210,19 +191,82 @@ article .article-metadata {
 }
 
 /*************************************************
- *  Author profile card
+ *  Content widgets
  **************************************************/
 
-.author-card {
-  margin-top: 1rem;
-  padding-top: 1rem;
+.content-widget-hr {
+  margin-top: 1.2rem;
+  padding-top: 1.2rem;
   border-top: 1px solid rgba(0,0,0,.05);
 }
 
-.dark .author-card {
+.dark .content-widget-hr {
   border-top: 1px solid rgba(255,255,255,.05);
 }
 
+/*************************************************
+ *  Tags
+ **************************************************/
+
+.article-tags {
+  margin-top: 1.2rem;
+}
+
+/*************************************************
+ *  Sharing
+ **************************************************/
+
+.share-box {
+  margin-top: 0.7rem;
+}
+
+ul.share {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: row;
+  flex-wrap: wrap;
+  list-style: none;
+  margin: 0;
+  padding: 0;
+}
+
+ul.share li {
+  display: inline-flex;
+  margin-right: 8px;
+}
+
+ul.share li:last-of-type {
+  margin-right: 0;
+}
+
+ul.share li i {
+  display: block;
+  width: 30px;
+  height: 30px;
+  line-height: 30px;
+  font-size: 22px;
+  text-align: center;
+  transition: all 150ms ease-in-out;
+}
+
+ul.share li a {
+  text-decoration: none !important;
+  color: rgba(0, 0, 0, 0.84);
+}
+
+.dark ul.share li a {
+  color: rgba(255, 255, 255, 0.84);
+}
+
+ul.share li:hover i {
+  transform: scale(1.2)
+}
+
+/*************************************************
+ *  Author profile card
+ **************************************************/
+
 .author-card .portrait {
   width: 60px;
   height: 60px;
@@ -273,54 +317,21 @@ article .article-metadata {
 }
 
 /*************************************************
- *  Sharing
+ *  Comments
  **************************************************/
 
-.share-box {
-  float: right;
-}
-
-ul.share {
-  display: flex;
-  flex-direction: row;
-  flex-wrap: wrap;
-  list-style: none;
-  margin: 0;
-  padding: 0;
-}
-
-ul.share li {
-  display: inline-flex;
-  margin-right: 5px;
-}
-
-ul.share li:last-of-type {
-  margin-right: 0;
-}
-
-ul.share li i {
-  display: block;
-  width: 30px;
-  height: 30px;
-  line-height: 30px;
-  font-size: 16px;
-  text-align: center;
-  transition: all 150ms ease-in-out;
-  color: #fff;
+#comments {
+  padding-top: 1rem;
 }
 
-.dark ul.share li i {
-  color: rgb(68, 71, 90);
-}
+/*************************************************
+ *  Related content
+ **************************************************/
 
-ul.share li a {
-  background-color: #b5c6ce;
-  display: block;
-  border-radius: 50%;
-  text-decoration: none !important;
-  margin: 0;
+.article-widget {
+  padding-top: 1.2rem;  /* Match .content-widget-hr */
 }
 
-ul.share li:hover i {
-  transform: scale(1.4)
+.article-widget h3 {
+  margin-top: 0;
 }

+ 0 - 4
assets/sass/academic/_dark.scss

@@ -51,10 +51,6 @@ body.dark,
   background-color: rgb(68, 71, 90) !important;
 }
 
-.dark ul.share li a {
-  background-color: $sta-primary;
-}
-
 .dark table table {
   background-color: rgb(40, 42, 54);
 }

+ 1 - 0
assets/sass/academic/_widgets.scss

@@ -294,6 +294,7 @@ ul.network-icon {
   justify-content: center;
   list-style: none;
   padding: 0;
+  margin: 0;
 }
 
 #profile .network-icon {

+ 1 - 1
data/page_sharer.toml

@@ -14,7 +14,7 @@
   url = "https://www.facebook.com/sharer.php?u={url}&t={title}"
   title = "Facebook"
   icon_pack = "fab"
-  icon = "facebook-f"
+  icon = "facebook"
   enable = true
 
 [[buttons]]

+ 1 - 27
layouts/_default/single.html

@@ -10,33 +10,7 @@
       {{ .Content }}
     </div>
 
-    {{ partial "page_edit" . }}
-
-    {{ partial "tags" . }}
-
-    {{ if ne .Type "page" }}
-      {{ partial "page_author" . }}
-      {{ $related := site.RegularPages.Related . | first 5 }}
-      {{ with $related }}
-      <div class="article-widget">
-        <div class="hr-light"></div>
-        <h3>{{ i18n "related" }}</h3>
-        <ul>
-          {{ range . }}
-          <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
-          {{ end }}
-        </ul>
-      </div>
-      {{ end }}
-    {{ end }}
-
-    {{ if site.Params.section_pager }}
-    <div class="article-widget">
-      {{ partial "section_pager" . }}
-    </div>
-    {{ end }}
-
-    {{ partial "comments" . }}
+    {{ partial "page_footer" . }}
 
   </div>
 </article>

+ 1 - 2
layouts/authors/list.html

@@ -22,8 +22,7 @@
     {{ $query := where .Pages ".IsNode" false }}
     {{ $count := len $query }}
     {{ if $count }}
-    <div class="article-widget">
-      <div class="hr-light"></div>
+    <div class="article-widget content-widget-hr">
       <h3>{{ i18n "user_profile_latest" | default "Latest" }}</h3>
       <ul>
         {{ range $query }}

+ 3 - 2
layouts/partials/page_author.html

@@ -1,6 +1,7 @@
 {{/* Author profile box */}}
 
-{{ if not (or (eq site.Params.profile false) (eq .Params.profile false)) }}
+{{/* Don't show author box on normal pages or if author box disabled. */}}
+{{ if ne .Type "page" | and (not (or (eq site.Params.profile false) (eq .Params.profile false))) }}
 
 {{/* Display superuser if superuser exists and page authors are not explicitly specified. */}}
 {{/* Otherwise, display first author if a profile for them exists. */}}
@@ -26,7 +27,7 @@
     {{ $profile_url = site.BaseURL }}
   {{ end }}
   {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
-  <div class="media author-card">
+  <div class="media author-card content-widget-hr">
     {{ if and site.Params.gravatar .Params.email }}
       <img class="portrait mr-3" src="https://s.gravatar.com/avatar/{{ md5 .Params.email }}?s=200')" alt="Avatar">
     {{ else if $avatar }}

+ 25 - 0
layouts/partials/page_footer.html

@@ -0,0 +1,25 @@
+{{ partial "page_edit" . }}
+{{ partial "tags" . }}
+{{ partial "share" . }}
+{{ partial "page_author" . }}
+{{ partial "comments" . }}
+
+{{ if site.Params.section_pager }}
+<div class="article-widget">
+  {{ partial "section_pager" . }}
+</div>
+{{ end }}
+
+{{ if ne .Type "page" }}
+  {{ $related := site.RegularPages.Related . | first 5 }}
+  {{ with $related }}
+  <div class="article-widget content-widget-hr">
+    <h3>{{ i18n "related" }}</h3>
+    <ul>
+      {{ range . }}
+      <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+      {{ end }}
+    </ul>
+  </div>
+  {{ end }}
+{{ end }}

+ 0 - 5
layouts/partials/page_metadata.html

@@ -1,5 +1,4 @@
 {{ $is_list := .is_list }}
-{{ $share := .share | default false }}
 {{ $page := .page }}
 
 <div class="article-metadata">
@@ -65,8 +64,4 @@
   </span>
   {{ end }}
 
-  {{ if $share }}
-    {{ partial "share.html" $page }}
-  {{ end }}
-
 </div>

+ 43 - 52
layouts/project/single.html

@@ -10,68 +10,59 @@
       {{ .Content }}
     </div>
 
-    {{ partial "tags.html" . }}
-    {{ partial "page_author.html" . }}
+    {{ partial "page_footer" . }}
 
-    {{ partial "comments" . }}
+    <div class="project-related-pages content-widget-hr">
+      {{ $page := . }}
+      {{ $project := .File.ContentBaseName }}
 
-    {{ $page := . }}
-    {{ $project := .File.ContentBaseName }}
-
-    {{ $items := where (where site.RegularPages "Type" "post") ".Params.projects" "intersect" (slice $project) }}
-    {{ $count := len $items }}
-    {{ if ge $count 1 }}
-      <h2>{{ (i18n "posts") }}</h2>
-      {{ range $items }}
-        {{ if eq site.Params.projects.post_view 1 }}
-          {{ partial "li_list" . }}
-        {{ else if eq site.Params.projects.post_view 3 }}
-          {{ partial "li_card" . }}
-        {{ else }}
-          {{ partial "li_compact" . }}
+      {{ $items := where (where site.RegularPages "Type" "post") ".Params.projects" "intersect" (slice $project) }}
+      {{ $count := len $items }}
+      {{ if ge $count 1 }}
+        <h2>{{ (i18n "posts") }}</h2>
+        {{ range $items }}
+          {{ if eq site.Params.projects.post_view 1 }}
+            {{ partial "li_list" . }}
+          {{ else if eq site.Params.projects.post_view 3 }}
+            {{ partial "li_card" . }}
+          {{ else }}
+            {{ partial "li_compact" . }}
+          {{ end }}
         {{ end }}
       {{ end }}
-    {{ end }}
 
-    {{ $items := where (where site.RegularPages "Type" "publication") ".Params.projects" "intersect" (slice $project) }}
-    {{ $pubs_len := len $items }}
-    {{ if ge $pubs_len 1 }}
-      <h2>{{ (i18n "publications") }}</h2>
-      {{ range $items }}
-        {{ if eq site.Params.projects.publication_view 1 }}
-          {{ partial "li_list" . }}
-        {{ else if eq site.Params.projects.publication_view 3 }}
-          {{ partial "li_card" . }}
-        {{ else if eq site.Params.projects.publication_view 4 }}
-          {{ partial "li_citation" . }}
-        {{ else }}
-          {{ partial "li_compact" . }}
+      {{ $items := where (where site.RegularPages "Type" "publication") ".Params.projects" "intersect" (slice $project) }}
+      {{ $pubs_len := len $items }}
+      {{ if ge $pubs_len 1 }}
+        <h2>{{ (i18n "publications") }}</h2>
+        {{ range $items }}
+          {{ if eq site.Params.projects.publication_view 1 }}
+            {{ partial "li_list" . }}
+          {{ else if eq site.Params.projects.publication_view 3 }}
+            {{ partial "li_card" . }}
+          {{ else if eq site.Params.projects.publication_view 4 }}
+            {{ partial "li_citation" . }}
+          {{ else }}
+            {{ partial "li_compact" . }}
+          {{ end }}
         {{ end }}
       {{ end }}
-    {{ end }}
 
-    {{ $items := where (where site.RegularPages "Type" "talk") ".Params.projects" "intersect" (slice $project) }}
-    {{ $talks_len := len $items }}
-    {{ if ge $talks_len 1 }}
-      <h2>{{ (i18n "talks") }}</h2>
-      {{ range $items }}
-        {{ if eq site.Params.projects.talk_view 1 }}
-          {{ partial "li_list" . }}
-        {{ else if eq site.Params.projects.talk_view 3 }}
-          {{ partial "li_card" . }}
-        {{ else }}
-          {{ partial "li_compact" . }}
+      {{ $items := where (where site.RegularPages "Type" "talk") ".Params.projects" "intersect" (slice $project) }}
+      {{ $talks_len := len $items }}
+      {{ if ge $talks_len 1 }}
+        <h2>{{ (i18n "talks") }}</h2>
+        {{ range $items }}
+          {{ if eq site.Params.projects.talk_view 1 }}
+            {{ partial "li_list" . }}
+          {{ else if eq site.Params.projects.talk_view 3 }}
+            {{ partial "li_card" . }}
+          {{ else }}
+            {{ partial "li_compact" . }}
+          {{ end }}
         {{ end }}
       {{ end }}
-    {{ end }}
-
+    </div>
   </div>
 </article>
-
-{{ if site.Params.section_pager }}
-<div class="article-container article-widget">
-  {{ partial "section_pager.html" . }}
-</div>
-{{ end }}
-
 {{- end -}}

+ 1 - 11
layouts/publication/single.html

@@ -50,18 +50,8 @@
 
     <div class="article-style">{{ .Content }}</div>
 
-    {{ partial "tags.html" . }}
-    {{ partial "page_author.html" . }}
-
-    {{ partial "comments" . }}
+    {{ partial "page_footer" . }}
 
   </div>
 </div>
-
-{{ if site.Params.section_pager }}
-<div class="article-container article-widget">
-  {{ partial "section_pager.html" . }}
-</div>
-{{ end }}
-
 {{- end -}}

+ 1 - 11
layouts/talk/single.html

@@ -74,18 +74,8 @@
       {{ .Content }}
     </div>
 
-    {{ partial "tags.html" . }}
-    {{ partial "page_author.html" . }}
-
-    {{ partial "comments" . }}
+    {{ partial "page_footer" . }}
 
   </div>
 </div>
-
-{{ if site.Params.section_pager }}
-<div class="article-container article-widget">
-  {{ partial "section_pager.html" . }}
-</div>
-{{ end }}
-
 {{- end -}}

+ 25 - 0
scripts/list_language_packs.py

@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+# List Available Language Packs
+# Used for updating the Languages page of the documentation.
+# https://sourcethemes.com/academic/
+#
+# Prerequisites: pip3 install PyYAML
+
+import yaml
+
+LANG_PATH = Path(__file__).resolve().parent.parent.joinpath('data').joinpath('i18n')
+LANG_YAML = LANG_PATH.joinpath('languages.yaml')
+
+
+# Iterate over languages.
+with open(LANG_YAML) as f:
+  master_map = yaml.safe_load(f)
+
+  # Print languages as a plaintext list.
+  # lang_list = [master_map[master_item] for master_item in master_map]
+  # print(', '.join(lang_list))
+
+  # Print languages as a Markdown list.
+  for master_item in master_map:
+    print(f'- **{master_map[master_item]}** ({master_item})')