BREAKING CHANGE: rename Post → Entry

* .Site.Params.post_meta → .Site.Params.Entry.meta
* .Site.Params.toc → .Site.Params.Entry.toc
* .Site.Params.tocOpen → .Site.Params.Entry.tocOpen
This commit is contained in:
vimux 2020-02-11 09:22:46 -05:00
parent a03c5ca663
commit 7bffa43920
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
16 changed files with 101 additions and 83 deletions

View file

@ -29,7 +29,7 @@
- [Columns](#columns) - [Columns](#columns)
- [Custom CSS](#custom-css) - [Custom CSS](#custom-css)
- [Custom JS](#custom-js) - [Custom JS](#custom-js)
- [Post Meta](#post-meta) - [Entry Meta](#entry-meta)
- [Related Content](#related-content) - [Related Content](#related-content)
- [Share Buttons](#share-buttons) - [Share Buttons](#share-buttons)
- [Featured Image](#featured-image) - [Featured Image](#featured-image)
@ -121,7 +121,7 @@ file. Here is Binario configuration example in TOML with all available theme-spe
baseurl = "/" baseurl = "/"
title = "Binario" title = "Binario"
languageCode = "en-us" languageCode = "en-us"
paginate = "10" # Number of posts per page paginate = "10" # Number of elements per page in pagination
theme = "binario" theme = "binario"
disqusShortname = "" # Enable comments by entering your Disqus shortname disqusShortname = "" # Enable comments by entering your Disqus shortname
googleAnalytics = "" # Enable Google Analytics by entering your tracking id 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 twitter_cards = true # Enable Twitter Cards if true
columns = 2 # Set the number of cards columns. Possible values: 1, 2, 3 columns = 2 # Set the number of cards columns. Possible values: 1, 2, 3
mainSections = ["post"] # Set main page sections 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 dateFormat = "January 02, 2006" # Change the format of dates
colorTheme = "" # dark-green, dark-blue, dark-red, dark-violet colorTheme = "" # dark-green, dark-blue, dark-red, dark-violet
customCSS = ["css/custom.css"] # Include custom CSS files customCSS = ["css/custom.css"] # Include custom CSS files
customJS = ["js/custom.js"] # Include custom JS files customJS = ["js/custom.js"] # Include custom JS files
mainMenuAlignment = "right" # Align main menu (desktop version) to the right side mainMenuAlignment = "right" # Align main menu (desktop version) to the right side
authorbox = true # Show authorbox at bottom of single pages if true 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 comments = true # Enable comments for all site pages
related = true # Enable Related content for single 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 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 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 mathjaxConfig = "TeX-AMS-MML_HTMLorMML" # Specify MathJax config. Optional
hideNoPostsWarning = false # Don't show no posts empty state warning in main page, if true 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] [Params.Featured]
previewOnly = false # Show only preview featured image 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" mastodon = "https://some.instance/@username"
medium = "username" medium = "username"
[Params.Share] # Post Share block [Params.Share] # Entry Share block
facebook = true facebook = true
twitter = true twitter = true
reddit = true reddit = true
@ -235,11 +237,15 @@ tags:
menu: main # Add page to a menu. Options: main, footer menu: main # Add page to a menu. Options: main, footer
# Theme-Defined params # Theme-Defined params
comments: true # Enable/disable Disqus comments for specific post comments: true # Enable/disable Disqus comments for specific page
authorbox: true # Enable/disable Authorbox for specific post authorbox: true # Enable/disable Authorbox for specific page
toc: true # Enable/disable Table of Contents for specific post toc: true # Enable/disable Table of Contents for specific page
mathjax: true # Enable/disable MathJax for specific post tocOpen: true # Open Table of Contents block for specific page
related: true # Enable/disable Related content for specific post mathjax: true # Enable/disable MathJax for specific page
related: true # Enable/disable Related content for specific page
meta:
- date
- categories
featured: featured:
url: image.jpg # relative path of the image url: image.jpg # relative path of the image
alt: A scale model of the Eiffel tower # alternate text for 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. 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 Entry metadata are relevant information about your entry such as published date, last modified date, category, etc. You
may activate post meta fields with `post_meta` parameter in config: may activate meta fields with `meta` parameter under the `[Params.Entry]` config section:
```toml ```toml
[Params] [Params.Entry]
post_meta = ["date", "categories"] meta = ["date", "categories"]
``` ```
#### Related Content #### Related Content
@ -366,8 +372,8 @@ For enabling breadcrumb partial globally (for all single and list pages), use `e
enable = true enable = true
``` ```
The global `.Site.Params.Breadcrumb.enable` param can be overridden for specific posts with `breadcrumb` page's front The global `.Site.Params.Breadcrumb.enable` param can be overridden for specific pages with `breadcrumb` front matter
matter param: param:
```yaml ```yaml
breadcrumb: false breadcrumb: false

View file

@ -400,12 +400,12 @@ button:not(:-moz-focusring):focus > .main-nav__btn-box {
} }
} }
/* Post */ /* Entry */
.title-excerpt { .title-excerpt {
font-size: 1.25rem; font-size: 1.25rem;
} }
.post__featured { .entry__featured {
width: 100%; width: 100%;
min-height: 1px; /* Workaround for IE11 flexbox img height issue https://github.com/philipwalton/flexbugs/issues/75 */ min-height: 1px; /* Workaround for IE11 flexbox img height issue https://github.com/philipwalton/flexbugs/issues/75 */
text-align: center; text-align: center;
@ -429,32 +429,32 @@ button:not(:-moz-focusring):focus > .main-nav__btn-box {
color: #888; color: #888;
} }
.post__content { .entry__content {
flex: 1 0 auto; flex: 1 0 auto;
margin: 0; margin: 0;
overflow: auto; overflow: auto;
color: #c3c3c3; color: #c3c3c3;
} }
.post__content p:last-child { .entry__content p:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.post__meta { .entry__meta {
font-size: .875rem; font-size: .875rem;
color: #999; color: #999;
} }
.post__meta-published, .entry__meta-published,
.post__meta-lastmod { .entry__meta-lastmod {
display: block; display: block;
} }
.post__tags { .entry__tags {
margin-top: 2rem; margin-top: 2rem;
} }
.post__tag { .entry__tag {
display: inline-block; display: inline-block;
padding: .25rem .5rem; padding: .25rem .5rem;
margin: .25rem; margin: .25rem;
@ -504,21 +504,21 @@ button:not(:-moz-focusring):focus > .main-nav__btn-box {
padding-left: 85px; padding-left: 85px;
} }
.post__footer { .entry__footer {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
margin-top: 1.5rem; margin-top: 1.5rem;
} }
.post__tags { .entry__tags {
display: flex; display: flex;
flex-basis: 100%; flex-basis: 100%;
flex-wrap: wrap; flex-wrap: wrap;
margin: 0 -.25rem auto; margin: 0 -.25rem auto;
} }
.post__share { .entry__share {
display: flex; display: flex;
flex-basis: 100%; flex-basis: 100%;
flex-wrap: wrap; flex-wrap: wrap;
@ -526,12 +526,12 @@ button:not(:-moz-focusring):focus > .main-nav__btn-box {
} }
@media screen and (min-width: 720px) { @media screen and (min-width: 720px) {
.post__tags { .entry__tags {
flex: 1 0 65%; flex: 1 0 65%;
justify-content: flex-start; justify-content: flex-start;
} }
.post__share { .entry__share {
flex: 1 0 35%; flex: 1 0 35%;
justify-content: flex-end; justify-content: flex-end;
} }

View file

@ -1,25 +1,25 @@
/* Print */ /* Print */
@media print { @media print {
.post__content a, .entry__content a,
.post__meta a, .entry__meta a,
.post__tag { .entry__tag {
color: #000; color: #000;
text-decoration: underline; text-decoration: underline;
} }
.logo, .logo,
.block, .block,
.post__title, .entry__title,
.post__title-link, .entry__title-link,
.meta-categories__link, .meta-categories__link,
.post__meta, .entry__meta,
.post__content { .entry__content {
color: #000; color: #000;
} }
.main-nav, .main-nav,
.comments, .comments,
.post__toc, .entry__toc,
.related, .related,
.footer__copyright-credits { .footer__copyright-credits {
display: none; display: none;

View file

@ -1,7 +1,8 @@
# Post # Entry
- id: post_toc - id: entry_toc
translation: "Table of Contents" translation: "Table of Contents"
# Entry meta
- id: meta_lastmod - id: meta_lastmod
translation: "Updated" translation: "Updated"

View file

@ -2,16 +2,16 @@
<main class="main"> <main class="main">
{{ partial "breadcrumb.html" . }} {{ partial "breadcrumb.html" . }}
<div class="single block"> <div class="single block">
<article class="post"> <article class="entry">
{{- partial "post_featured.html" (dict "page" . "IsSingle" true) }} {{- partial "entry/featured.html" (dict "page" . "IsSingle" true) }}
{{- partial "post_meta.html" (dict "page" . "class" "mb") }} {{- partial "entry/meta.html" (dict "page" . "class" "mb") }}
<h1 class="post__title">{{ .Title }}</h1> <h1 class="entry__title">{{ .Title }}</h1>
{{- partial "post_toc.html" . }} {{- partial "entry/toc.html" . }}
<div class="post__content">{{ .Content }}</div> <div class="entry__content">{{ .Content }}</div>
{{ if or (.Param "share") (isset $.Params "tags") }} {{ if or (.Param "share") (isset $.Params "tags") }}
<footer class="post__footer"> <footer class="entry__footer">
{{ partial "post_tags.html" . }} {{ partial "entry/tags.html" . }}
{{ partial "post_share.html" . }} {{ partial "entry/share.html" . }}
</footer> </footer>
{{ end }} {{ end }}
</article> </article>

View file

@ -1,8 +1,8 @@
<article class="post card__box block"> <article class="entry card__box block">
{{- partial "post_featured.html" (dict "page" . "link" .RelPermalink) }} {{- partial "entry/featured.html" (dict "page" . "link" .RelPermalink) }}
<h1 class="post__title title-excerpt"><a class="post__title-link" href="{{ .RelPermalink }}">{{ .Title }}</a></h1> <h1 class="entry__title title-excerpt"><a class="entry__title-link" href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
{{- with .Summary }} {{- with .Summary }}
<div class="post__content">{{ . }}</div> <div class="entry__content">{{ . }}</div>
{{- end }} {{- end }}
{{- partial "post_meta.html" (dict "page" . "class" "mt tar") }} {{- partial "entry/meta.html" (dict "page" . "class" "mt tar") }}
</article> </article>

View file

@ -12,7 +12,7 @@
{{- $featured := .GetMatch ($match | default "{featured.*,thumbnail.*}") -}} {{- $featured := .GetMatch ($match | default "{featured.*,thumbnail.*}") -}}
{{ if and $featured (not (and $IsSingle ($.page.Param "featured.previewOnly"))) }} {{ if and $featured (not (and $IsSingle ($.page.Param "featured.previewOnly"))) }}
<figure class="post__featured featured"> <figure class="entry__featured featured">
{{- with $link }}<a class="featured__link" href="{{ . }}">{{ end }} {{- with $link }}<a class="featured__link" href="{{ . }}">{{ end }}
<img class="featured__img" src="{{ $featured.RelPermalink }}" alt=" <img class="featured__img" src="{{ $featured.RelPermalink }}" alt="
{{- with $featuredMap -}} {{- with $featuredMap -}}

View file

@ -0,0 +1,11 @@
{{- $page := .page -}}
{{- $pageMeta := default $page.Site.Params.Entry.meta $page.Params.meta -}}
{{- with $pageMeta }}
<div class="entry__meta meta {{ $.class }}">
{{- range . }}
{{- $metaFieldPath := printf "entry/meta/%s.html" . -}}
{{- partial $metaFieldPath $page -}}
{{- end }}
</div>
{{- end }}

View file

@ -0,0 +1,11 @@
{{- if .Params.categories }}
<span class="entry__meta-categories meta-categories">
<span class="meta-categories__list">{{ T "meta_categories" }}:
{{- range $index, $category := .Params.categories }}{{ if gt $index 0 }}, {{ end }}
<a class="meta-categories__link" href="{{ "categories/" | relLangURL }}{{ . | urlize | lower }}" rel="category">
{{- . -}}
</a>
{{- end }}
</span>
</span>
{{- end }}

View file

@ -1,10 +1,10 @@
{{- if not .Date.IsZero }} {{- if not .Date.IsZero }}
<time class="post__meta-published meta-published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> <time class="entry__meta-published meta-published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Date.Format (.Site.Params.dateFormat | default "January 02, 2006") -}} {{- .Date.Format (.Site.Params.dateFormat | default "January 02, 2006") -}}
</time> </time>
{{- end }} {{- end }}
{{- if ne .Date .Lastmod }} {{- if ne .Date .Lastmod }}
<time class="post__meta-lastmod meta-lastmod" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}"> <time class="entry__meta-lastmod meta-lastmod" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
{{- T "meta_lastmod" }}: {{ .Lastmod.Format (.Site.Params.dateFormat | default "January 02, 2006") -}} {{- T "meta_lastmod" }}: {{ .Lastmod.Format (.Site.Params.dateFormat | default "January 02, 2006") -}}
</time> </time>
{{- end }} {{- end }}

View file

@ -1,5 +1,5 @@
{{- if and .IsPage (.Param "share") }} {{- if and .IsPage (.Param "share") }}
<div class="post__share share"> <div class="entry__share share">
{{- if .Param "share.facebook" }} {{- if .Param "share.facebook" }}
<a class="share__link btn" title="{{ T "share-caption" }} Facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener noreferrer" onclick="window.open(this.href, '{{ T "share-caption" }} Facebook', 'width=800,height=600,toolbar=0,status=0'); return false"> <a class="share__link btn" title="{{ T "share-caption" }} Facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener noreferrer" onclick="window.open(this.href, '{{ T "share-caption" }} Facebook', 'width=800,height=600,toolbar=0,status=0'); return false">
{{ partial "svg/facebook.svg" (dict "class" "share__icon" ) }} {{ partial "svg/facebook.svg" (dict "class" "share__icon" ) }}

View file

@ -1,11 +1,11 @@
{{- $taxo := "tags" -}} {{- $taxo := "tags" -}}
{{- with .Param $taxo }} {{- with .Param $taxo }}
<div class="post__tags"> <div class="entry__tags">
{{- range . }} {{- range . }}
{{- $url := urls.Parse (. | urlize) -}} {{- $url := urls.Parse (. | urlize) -}}
{{- $path := $url.Path -}} {{- $path := $url.Path -}}
{{- with $.Site.GetPage (printf "/%s/%s" $taxo $path) }} {{- with $.Site.GetPage (printf "/%s/%s" $taxo $path) }}
<a class="post__tag btn" href="{{ .RelPermalink }}">{{ .Title }}</a> <a class="entry__tag btn" href="{{ .RelPermalink }}">{{ .Title }}</a>
{{- end }} {{- end }}
{{- end }} {{- end }}
</div> </div>

View file

@ -0,0 +1,9 @@
{{- $toc := default .Site.Params.Entry.toc .Params.toc -}}
{{- $tocOpen := default .Site.Params.Entry.tocOpen .Params.tocOpen -}}
{{- if $toc }}
<details class="entry__toc toc" {{ if $tocOpen }}open{{ end }}>
<summary class="toc__title">{{- T "entry_toc" -}}</summary>
{{ .TableOfContents }}
</details>
{{- end }}

View file

@ -1,9 +0,0 @@
{{ $currentPage := .page }}
{{- if .page.Param "post_meta" }}
<div class="post__meta meta {{ .class }}">
{{- range $metaField := .page.Param "post_meta" -}}
{{- $metaFieldPath := printf "post_meta/%s.html" $metaField -}}
{{- partial $metaFieldPath $currentPage -}}
{{ end }}
</div>
{{ end }}

View file

@ -1,5 +0,0 @@
{{- if .Params.categories }}
<span class="post__meta-categories meta-categories">
<span class="meta-categories__list">{{ T "meta_categories" }}: {{ range $index, $category := .Params.categories }}{{ if gt $index 0 }}, {{ end }}<a class="meta-categories__link" href="{{ "categories/" | relLangURL }}{{ . | urlize | lower }}" rel="category">{{ . }}</a>{{ end }}</span>
</span>
{{- end }}

View file

@ -1,6 +0,0 @@
{{ if .Param "toc" }}
<details class="post__toc toc" {{ if .Params.tocOpen }}open{{ end }}>
<summary class="toc__title">{{- T "post_toc" -}}</summary>
{{ .TableOfContents }}
</details>
{{ end }}