From 7bffa439207dfbbda04748a7e5559eb1b3d8f962 Mon Sep 17 00:00:00 2001 From: vimux Date: Tue, 11 Feb 2020 09:22:46 -0500 Subject: [PATCH] =?UTF-8?q?BREAKING=20CHANGE:=20rename=20Post=20=E2=86=92?= =?UTF-8?q?=20Entry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * .Site.Params.post_meta → .Site.Params.Entry.meta * .Site.Params.toc → .Site.Params.Entry.toc * .Site.Params.tocOpen → .Site.Params.Entry.tocOpen --- README.md | 44 +++++++++++-------- assets/css/main.css | 28 ++++++------ assets/css/print.css | 16 +++---- i18n/en.yaml | 5 ++- layouts/_default/single.html | 18 ++++---- layouts/_default/summary.html | 10 ++--- .../featured.html} | 2 +- layouts/partials/entry/meta.html | 11 +++++ layouts/partials/entry/meta/categories.html | 11 +++++ .../{post_meta => entry/meta}/date.html | 4 +- .../{post_share.html => entry/share.html} | 2 +- .../{post_tags.html => entry/tags.html} | 4 +- layouts/partials/entry/toc.html | 9 ++++ layouts/partials/post_meta.html | 9 ---- layouts/partials/post_meta/categories.html | 5 --- layouts/partials/post_toc.html | 6 --- 16 files changed, 101 insertions(+), 83 deletions(-) rename layouts/partials/{post_featured.html => entry/featured.html} (96%) create mode 100644 layouts/partials/entry/meta.html create mode 100644 layouts/partials/entry/meta/categories.html rename layouts/partials/{post_meta => entry/meta}/date.html (55%) rename layouts/partials/{post_share.html => entry/share.html} (99%) rename layouts/partials/{post_tags.html => entry/tags.html} (70%) create mode 100644 layouts/partials/entry/toc.html delete mode 100644 layouts/partials/post_meta.html delete mode 100644 layouts/partials/post_meta/categories.html delete mode 100644 layouts/partials/post_toc.html diff --git a/README.md b/README.md index c85cf27..45861f9 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ - [Columns](#columns) - [Custom CSS](#custom-css) - [Custom JS](#custom-js) - - [Post Meta](#post-meta) + - [Entry Meta](#entry-meta) - [Related Content](#related-content) - [Share Buttons](#share-buttons) - [Featured Image](#featured-image) @@ -121,7 +121,7 @@ file. Here is Binario configuration example in TOML with all available theme-spe baseurl = "/" title = "Binario" languageCode = "en-us" -paginate = "10" # Number of posts per page +paginate = "10" # Number of elements per page in pagination theme = "binario" disqusShortname = "" # Enable comments by entering your Disqus shortname googleAnalytics = "" # Enable Google Analytics by entering your tracking id @@ -138,23 +138,25 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id twitter_cards = true # Enable Twitter Cards if true columns = 2 # Set the number of cards columns. Possible values: 1, 2, 3 mainSections = ["post"] # Set main page sections - post_meta = ["date", "categories"] # Enable post meta fields in given order dateFormat = "January 02, 2006" # Change the format of dates colorTheme = "" # dark-green, dark-blue, dark-red, dark-violet customCSS = ["css/custom.css"] # Include custom CSS files customJS = ["js/custom.js"] # Include custom JS files mainMenuAlignment = "right" # Align main menu (desktop version) to the right side authorbox = true # Show authorbox at bottom of single pages if true - toc = true # Enable Table of Contents for all site pages - tocOpen = true # Open Table of Contents block. Optional comments = true # Enable comments for all site pages related = true # Enable Related content for single pages - relatedMax = 5 # Set the maximum number of posts that can be displayed in related block. Optional + relatedMax = 5 # Set the maximum number of elements that can be displayed in related block. Optional mathjax = true # Enable MathJax for all site pages mathjaxPath = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js" # Specify MathJax path. Optional mathjaxConfig = "TeX-AMS-MML_HTMLorMML" # Specify MathJax config. Optional hideNoPostsWarning = false # Don't show no posts empty state warning in main page, if true +[Params.Entry] + meta = ["date", "categories"] # Enable meta fields in given order + toc = true # Enable Table of Contents + tocOpen = true # Open Table of Contents block. Optional + [Params.Featured] previewOnly = false # Show only preview featured image @@ -177,7 +179,7 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id mastodon = "https://some.instance/@username" medium = "username" -[Params.Share] # Post Share block +[Params.Share] # Entry Share block facebook = true twitter = true reddit = true @@ -235,11 +237,15 @@ tags: menu: main # Add page to a menu. Options: main, footer # Theme-Defined params -comments: true # Enable/disable Disqus comments for specific post -authorbox: true # Enable/disable Authorbox for specific post -toc: true # Enable/disable Table of Contents for specific post -mathjax: true # Enable/disable MathJax for specific post -related: true # Enable/disable Related content for specific post +comments: true # Enable/disable Disqus comments for specific page +authorbox: true # Enable/disable Authorbox for specific page +toc: true # Enable/disable Table of Contents for specific page +tocOpen: true # Open Table of Contents block for specific page +mathjax: true # Enable/disable MathJax for specific page +related: true # Enable/disable Related content for specific page +meta: + - date + - categories featured: url: image.jpg # relative path of the image alt: A scale model of the Eiffel tower # alternate text for the image @@ -302,14 +308,14 @@ relative to the `static` folder of your Hugo site: All custom JS files will be added before closing body tag of a `baseof.html` file. -#### Post Meta +#### Entry Meta -Post metadata are relevant information about your post such as published date, last modified date, category, etc. You -may activate post meta fields with `post_meta` parameter in config: +Entry metadata are relevant information about your entry such as published date, last modified date, category, etc. You +may activate meta fields with `meta` parameter under the `[Params.Entry]` config section: ```toml -[Params] - post_meta = ["date", "categories"] +[Params.Entry] + meta = ["date", "categories"] ``` #### Related Content @@ -366,8 +372,8 @@ For enabling breadcrumb partial globally (for all single and list pages), use `e enable = true ``` -The global `.Site.Params.Breadcrumb.enable` param can be overridden for specific posts with `breadcrumb` page's front -matter param: +The global `.Site.Params.Breadcrumb.enable` param can be overridden for specific pages with `breadcrumb` front matter +param: ```yaml breadcrumb: false diff --git a/assets/css/main.css b/assets/css/main.css index d8cdf56..8b95e69 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -400,12 +400,12 @@ button:not(:-moz-focusring):focus > .main-nav__btn-box { } } -/* Post */ +/* Entry */ .title-excerpt { font-size: 1.25rem; } -.post__featured { +.entry__featured { width: 100%; min-height: 1px; /* Workaround for IE11 flexbox img height issue https://github.com/philipwalton/flexbugs/issues/75 */ text-align: center; @@ -429,32 +429,32 @@ button:not(:-moz-focusring):focus > .main-nav__btn-box { color: #888; } -.post__content { +.entry__content { flex: 1 0 auto; margin: 0; overflow: auto; color: #c3c3c3; } -.post__content p:last-child { +.entry__content p:last-child { margin-bottom: 0; } -.post__meta { +.entry__meta { font-size: .875rem; color: #999; } -.post__meta-published, -.post__meta-lastmod { +.entry__meta-published, +.entry__meta-lastmod { display: block; } -.post__tags { +.entry__tags { margin-top: 2rem; } -.post__tag { +.entry__tag { display: inline-block; padding: .25rem .5rem; margin: .25rem; @@ -504,21 +504,21 @@ button:not(:-moz-focusring):focus > .main-nav__btn-box { padding-left: 85px; } -.post__footer { +.entry__footer { display: flex; flex-wrap: wrap; justify-content: space-between; margin-top: 1.5rem; } -.post__tags { +.entry__tags { display: flex; flex-basis: 100%; flex-wrap: wrap; margin: 0 -.25rem auto; } -.post__share { +.entry__share { display: flex; flex-basis: 100%; flex-wrap: wrap; @@ -526,12 +526,12 @@ button:not(:-moz-focusring):focus > .main-nav__btn-box { } @media screen and (min-width: 720px) { - .post__tags { + .entry__tags { flex: 1 0 65%; justify-content: flex-start; } - .post__share { + .entry__share { flex: 1 0 35%; justify-content: flex-end; } diff --git a/assets/css/print.css b/assets/css/print.css index 3fffa17..df6d1c9 100644 --- a/assets/css/print.css +++ b/assets/css/print.css @@ -1,25 +1,25 @@ /* Print */ @media print { - .post__content a, - .post__meta a, - .post__tag { + .entry__content a, + .entry__meta a, + .entry__tag { color: #000; text-decoration: underline; } .logo, .block, - .post__title, - .post__title-link, + .entry__title, + .entry__title-link, .meta-categories__link, - .post__meta, - .post__content { + .entry__meta, + .entry__content { color: #000; } .main-nav, .comments, - .post__toc, + .entry__toc, .related, .footer__copyright-credits { display: none; diff --git a/i18n/en.yaml b/i18n/en.yaml index 0b62a29..aca6aed 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -1,7 +1,8 @@ -# Post -- id: post_toc +# Entry +- id: entry_toc translation: "Table of Contents" +# Entry meta - id: meta_lastmod translation: "Updated" diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6134f74..623bd31 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,16 +2,16 @@
{{ partial "breadcrumb.html" . }}
-
- {{- partial "post_featured.html" (dict "page" . "IsSingle" true) }} - {{- partial "post_meta.html" (dict "page" . "class" "mb") }} -

{{ .Title }}

- {{- partial "post_toc.html" . }} -
{{ .Content }}
+
+ {{- partial "entry/featured.html" (dict "page" . "IsSingle" true) }} + {{- partial "entry/meta.html" (dict "page" . "class" "mb") }} +

{{ .Title }}

+ {{- partial "entry/toc.html" . }} +
{{ .Content }}
{{ if or (.Param "share") (isset $.Params "tags") }} -
- {{ partial "post_tags.html" . }} - {{ partial "post_share.html" . }} +
+ {{ partial "entry/tags.html" . }} + {{ partial "entry/share.html" . }}
{{ end }}
diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 010494f..d0cf463 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -1,8 +1,8 @@ -
- {{- partial "post_featured.html" (dict "page" . "link" .RelPermalink) }} -

{{ .Title }}

+
+ {{- partial "entry/featured.html" (dict "page" . "link" .RelPermalink) }} +

{{ .Title }}

{{- with .Summary }} -
{{ . }}
+
{{ . }}
{{- end }} - {{- partial "post_meta.html" (dict "page" . "class" "mt tar") }} + {{- partial "entry/meta.html" (dict "page" . "class" "mt tar") }}
\ No newline at end of file diff --git a/layouts/partials/post_featured.html b/layouts/partials/entry/featured.html similarity index 96% rename from layouts/partials/post_featured.html rename to layouts/partials/entry/featured.html index e38966e..b518a59 100644 --- a/layouts/partials/post_featured.html +++ b/layouts/partials/entry/featured.html @@ -12,7 +12,7 @@ {{- $featured := .GetMatch ($match | default "{featured.*,thumbnail.*}") -}} {{ if and $featured (not (and $IsSingle ($.page.Param "featured.previewOnly"))) }} -
+
{{- with $link }}{{ end }} 
 					{{- with $featuredMap -}}
diff --git a/layouts/partials/entry/meta.html b/layouts/partials/entry/meta.html
new file mode 100644
index 0000000..338204b
--- /dev/null
+++ b/layouts/partials/entry/meta.html
@@ -0,0 +1,11 @@
+{{- $page := .page -}}
+{{- $pageMeta := default $page.Site.Params.Entry.meta $page.Params.meta -}}
+
+{{- with $pageMeta }}
+	<div class= + {{- range . }} + {{- $metaFieldPath := printf "entry/meta/%s.html" . -}} + {{- partial $metaFieldPath $page -}} + {{- end }} +
+{{- end }} \ No newline at end of file diff --git a/layouts/partials/entry/meta/categories.html b/layouts/partials/entry/meta/categories.html new file mode 100644 index 0000000..709a106 --- /dev/null +++ b/layouts/partials/entry/meta/categories.html @@ -0,0 +1,11 @@ +{{- if .Params.categories }} + + {{- . -}} + + {{- end }} + + +{{- end }} \ No newline at end of file diff --git a/layouts/partials/post_meta/date.html b/layouts/partials/entry/meta/date.html similarity index 55% rename from layouts/partials/post_meta/date.html rename to layouts/partials/entry/meta/date.html index 91eee84..a6e2f69 100644 --- a/layouts/partials/post_meta/date.html +++ b/layouts/partials/entry/meta/date.html @@ -1,10 +1,10 @@ {{- if not .Date.IsZero }} -