mirror of
https://github.com/Vimux/Binario.git
synced 2024-12-21 20:19:06 +00:00
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:
parent
a03c5ca663
commit
7bffa43920
16 changed files with 101 additions and 83 deletions
44
README.md
44
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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Post
|
||||
- id: post_toc
|
||||
# Entry
|
||||
- id: entry_toc
|
||||
translation: "Table of Contents"
|
||||
|
||||
# Entry meta
|
||||
- id: meta_lastmod
|
||||
translation: "Updated"
|
||||
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
<main class="main">
|
||||
{{ partial "breadcrumb.html" . }}
|
||||
<div class="single block">
|
||||
<article class="post">
|
||||
{{- partial "post_featured.html" (dict "page" . "IsSingle" true) }}
|
||||
{{- partial "post_meta.html" (dict "page" . "class" "mb") }}
|
||||
<h1 class="post__title">{{ .Title }}</h1>
|
||||
{{- partial "post_toc.html" . }}
|
||||
<div class="post__content">{{ .Content }}</div>
|
||||
<article class="entry">
|
||||
{{- partial "entry/featured.html" (dict "page" . "IsSingle" true) }}
|
||||
{{- partial "entry/meta.html" (dict "page" . "class" "mb") }}
|
||||
<h1 class="entry__title">{{ .Title }}</h1>
|
||||
{{- partial "entry/toc.html" . }}
|
||||
<div class="entry__content">{{ .Content }}</div>
|
||||
{{ if or (.Param "share") (isset $.Params "tags") }}
|
||||
<footer class="post__footer">
|
||||
{{ partial "post_tags.html" . }}
|
||||
{{ partial "post_share.html" . }}
|
||||
<footer class="entry__footer">
|
||||
{{ partial "entry/tags.html" . }}
|
||||
{{ partial "entry/share.html" . }}
|
||||
</footer>
|
||||
{{ end }}
|
||||
</article>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<article class="post card__box block">
|
||||
{{- partial "post_featured.html" (dict "page" . "link" .RelPermalink) }}
|
||||
<h1 class="post__title title-excerpt"><a class="post__title-link" href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
|
||||
<article class="entry card__box block">
|
||||
{{- partial "entry/featured.html" (dict "page" . "link" .RelPermalink) }}
|
||||
<h1 class="entry__title title-excerpt"><a class="entry__title-link" href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
|
||||
{{- with .Summary }}
|
||||
<div class="post__content">{{ . }}</div>
|
||||
<div class="entry__content">{{ . }}</div>
|
||||
{{- end }}
|
||||
{{- partial "post_meta.html" (dict "page" . "class" "mt tar") }}
|
||||
{{- partial "entry/meta.html" (dict "page" . "class" "mt tar") }}
|
||||
</article>
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
{{- $featured := .GetMatch ($match | default "{featured.*,thumbnail.*}") -}}
|
||||
{{ 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 }}
|
||||
<img class="featured__img" src="{{ $featured.RelPermalink }}" alt="
|
||||
{{- with $featuredMap -}}
|
11
layouts/partials/entry/meta.html
Normal file
11
layouts/partials/entry/meta.html
Normal 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 }}
|
11
layouts/partials/entry/meta/categories.html
Normal file
11
layouts/partials/entry/meta/categories.html
Normal 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 }}
|
|
@ -1,10 +1,10 @@
|
|||
{{- 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") -}}
|
||||
</time>
|
||||
{{- end }}
|
||||
{{- 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") -}}
|
||||
</time>
|
||||
{{- end }}
|
|
@ -1,5 +1,5 @@
|
|||
{{- if and .IsPage (.Param "share") }}
|
||||
<div class="post__share share">
|
||||
<div class="entry__share share">
|
||||
{{- 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">
|
||||
{{ partial "svg/facebook.svg" (dict "class" "share__icon" ) }}
|
|
@ -1,11 +1,11 @@
|
|||
{{- $taxo := "tags" -}}
|
||||
{{- with .Param $taxo }}
|
||||
<div class="post__tags">
|
||||
<div class="entry__tags">
|
||||
{{- range . }}
|
||||
{{- $url := urls.Parse (. | urlize) -}}
|
||||
{{- $path := $url.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 }}
|
||||
</div>
|
9
layouts/partials/entry/toc.html
Normal file
9
layouts/partials/entry/toc.html
Normal 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 }}
|
|
@ -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 }}
|
|
@ -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 }}
|
|
@ -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 }}
|
Loading…
Reference in a new issue