Skip to content

Commit

Permalink
fix: style of post-meta, busuanzi-site-uv-and-pv
Browse files Browse the repository at this point in the history
  • Loading branch information
reuixiy committed Dec 27, 2019
1 parent 3cc100b commit a4e4137
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 49 deletions.
12 changes: 12 additions & 0 deletions assets/scss/_common/busuanzi.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.busuanzi-site-uv-and-pv {
font-size: 90%;
}

.busuanzi-site-uv {
height: 0.85em;
margin-bottom: 0.2em;
}

.busuanzi-site-pv {
margin-bottom: 0.1em;
}
2 changes: 1 addition & 1 deletion assets/scss/_common/fonts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}

@if variable-exists("fontFamilyCode") {
code, pre, sup, .post-meta, .updated-badge, .post-gitinfo, .minimal-footer, .minimal-footer-about {
code, pre, sup, .post-meta, .updated-badge, .post-gitinfo, .minimal-footer, .minimal-footer-about, .busuanzi-site-uv-and-pv {
font-family: $fontFamilyCode;
}
}
Expand Down
4 changes: 2 additions & 2 deletions assets/scss/_common/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
}

.footer-icon {
margin: 0 0.5em 0.3em;
}
margin: 0 0.25em 0.3em;
}
1 change: 0 additions & 1 deletion assets/scss/_common/post-meta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@

.post-meta-icon {
fill: alpha(var(--color-contrast-medium), 0.5);
margin-right: 0.5em;
margin-bottom: 0.3em;
}
3 changes: 3 additions & 0 deletions assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@
animation: heartbeat 1.33s ease-in-out infinite;
}
{{ end }}
{{ if and .Site.Params.displayBusuanziSiteUVAndPV (eq hugo.Environment "production") }}
@import "_common/busuanzi.scss";
{{ end }}
{{ end }}

{{ if eq .Site.Params.homeLayout "poetry" }}
Expand Down
2 changes: 1 addition & 1 deletion config-examples/en-us/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ uglyURLs = false
fontFamilyTitle = "Comfortaa, sans-serif"
# Headings, toc title
fontFamilyHeadings = "Comfortaa, sans-serif"
# Code, superscript, post meta info, post updated badge, post gitinfo, minimal footer
# Code, superscript, post meta info, post updated badge, post gitinfo, minimal footer, busuanzi site view counter
fontFamilyCode = "'Source Code Pro', monospace"
# Blockquotes
fontFamilyQuote = ""
Expand Down
2 changes: 1 addition & 1 deletion config-examples/zh-cn/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ uglyURLs = false
fontFamilyTitle = "'Noto Serif SC', 'EB Garamond', serif"
# 分节标题、目录标题
fontFamilyHeadings = "'Noto Serif SC', 'EB Garamond', serif"
# 代码、上标、文章元信息、文章更新徽章、文章的 Git 版本信息、极简页脚
# 代码、上标、文章元信息、文章更新徽章、文章的 Git 版本信息、极简页脚、不蒜子站点浏览计数
fontFamilyCode = "'Source Code Pro', 'Noto Serif SC', monospace"
# 引用
fontFamilyQuote = ""
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Target":"css/meme.min.23a3789aeb10501ab7dabd657d79b9001b7f3a007c7198a5f54cd9a513185b03.css","MediaType":"text/css","Data":{"Integrity":"sha256-I6N4musQUBq32r1lfXm5ABt/OgB8cZil9UzZpRMYWwM="}}
{"Target":"css/meme.min.1a62b125ec50989ec305a5ba8a826c7705be1471ede622b2b26d2f8dcc536843.css","MediaType":"text/css","Data":{"Integrity":"sha256-GmKxJexQmJ7DBaW6ioJsdwW+FHHt5iKysm0vjcxTaEM="}}
90 changes: 57 additions & 33 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,54 +1,78 @@
{{ if and .Site.Params.enableFooter (not (and .IsHome (in (slice "poetry" "footage") .Site.Params.homeLayout))) }}
<footer id="footer" class="footer">
<div class="footer-inner">
{{ if .Site.Params.displayCopyrightSymbol }}
{{ .Scratch.Set "siteInfoCopyright" "©&nbsp;" }}
{{ else }}
{{ .Scratch.Set "siteInfoCopyright" "" }}
{{ end }}
{{ $siteInfoCopyright := .Scratch.Get "siteInfoCopyright" }}

{{ if .Site.Params.displaySiteCreatedYear }}
{{ .Scratch.Set "siteInfoCreatedYear" (printf `%s–%s` (dateFormat "2006" (time .Site.Params.siteCreatedTime)) (now.Format "2006")) }}
{{ else }}
{{ .Scratch.Set "siteInfoCreatedYear" (now.Format "2006") }}
{{ end }}
{{ $siteInfoCreatedYear := .Scratch.Get "siteInfoCreatedYear" }}

{{ with .Site.Params.iconBetweenYearAndAuthor }}
{{ $.Scratch.Set "siteInfoIcon" (replace (index $.Site.Data.SVG .) "icon" "icon footer-icon") }}
{{ else }}
{{ $.Scratch.Set "siteInfoIcon" "&nbsp;" }}
{{ end }}
{{ $siteInfoIcon := .Scratch.Get "siteInfoIcon" }}
{{- if .Site.Params.displayCopyrightSymbol -}}
{{- .Scratch.Set "siteInfoCopyright" "©&nbsp;" -}}
{{- else -}}
{{- .Scratch.Set "siteInfoCopyright" "" -}}
{{- end -}}
{{- $siteInfoCopyright := .Scratch.Get "siteInfoCopyright" -}}

{{- if .Site.Params.displaySiteCreatedYear -}}
{{- .Scratch.Set "siteInfoCreatedYear" (printf `%s–%s` (dateFormat "2006" (time .Site.Params.siteCreatedTime)) (now.Format "2006")) -}}
{{- else -}}
{{- .Scratch.Set "siteInfoCreatedYear" (now.Format "2006") -}}
{{- end -}}
{{- $siteInfoCreatedYear := .Scratch.Get "siteInfoCreatedYear" -}}

{{- with .Site.Params.iconBetweenYearAndAuthor -}}
{{- $.Scratch.Set "siteInfoIcon" (printf `&nbsp;%s&nbsp;` (replace (index $.Site.Data.SVG .) "icon" "icon footer-icon")) -}}
{{- else -}}
{{- $.Scratch.Set "siteInfoIcon" "&nbsp;" -}}
{{- end -}}
{{- $siteInfoIcon := .Scratch.Get "siteInfoIcon" -}}

<div class="site-info">{{ printf `%s%s%s%s` $siteInfoCopyright $siteInfoCreatedYear $siteInfoIcon .Site.Author.name | safeHTML }}</div>

{{ if .Site.Params.displayPoweredBy }}
{{- if .Site.Params.displayPoweredBy }}
<div class="powered-by">{{ printf `Powered by [Hugo](https://github.com/gohugoio/hugo) | Theme is [MemE](https://github.com/reuixiy/hugo-theme-meme)` | markdownify | safeHTML }}</div>
{{ end }}
{{- end }}

{{ if .Site.Params.displaySiteCopyright }}
{{- if .Site.Params.displaySiteCopyright }}
<div class="site-copyright">{{ .Site.Copyright | markdownify | safeHTML }}</div>
{{ end }}
{{- end }}

{{ with .Site.Params.customFooter }}
{{- with .Site.Params.customFooter }}
<div class="custom-footer">{{ . | markdownify | safeHTML }}</div>
{{ end }}
{{- end }}

{{ if and .Site.Params.displayBusuanziSiteUVAndPV (eq hugo.Environment "production") }}
{{ $busuanziSiteUVIcon := replace (index $.Site.Data.SVG $.Site.Params.busuanziSiteUVIcon) "icon" "icon busuanzi-site-uv" }}
{{ $busuanziSitePVIcon := replace (index $.Site.Data.SVG $.Site.Params.busuanziSitePVIcon) "icon" "icon busuanzi-site-pv" }}
{{- if and .Site.Params.displayBusuanziSiteUVAndPV (eq hugo.Environment "production") }}
<div class="busuanzi-site-uv-and-pv">
<span id="busuanzi_container_site_uv">
{{ printf `%s %s %s` .Site.Params.busuanziSiteUVText $busuanziSiteUVIcon `<span id="busuanzi_value_site_uv"></span>` | safeHTML }}
{{- with .Site.Params.busuanziSiteUVText -}}
{{- $.Scratch.Set "busuanziSiteUVText" (printf `%s&nbsp;` .) -}}
{{- else -}}
{{- $.Scratch.Set "busuanziSiteUVText" "" -}}
{{- end -}}
{{- $busuanziSiteUVText := .Scratch.Get "busuanziSiteUVText" -}}
{{- with .Site.Params.busuanziSiteUVIcon -}}
{{- $busuanziSiteUVIcon := replace (index $.Site.Data.SVG $.Site.Params.busuanziSiteUVIcon) "icon" "icon busuanzi-site-uv" -}}
{{- $.Scratch.Set "busuanziSiteUVIcon" (printf `%s&nbsp;` $busuanziSiteUVIcon) -}}
{{- else -}}
{{- $.Scratch.Set "busuanziSiteUVIcon" "" -}}
{{- end -}}
{{- $busuanziSiteUVIcon := .Scratch.Get "busuanziSiteUVIcon" -}}
{{- printf `%s%s%s` $busuanziSiteUVText $busuanziSiteUVIcon `<span id="busuanzi_value_site_uv"></span>` | safeHTML -}}
</span>
{{- print " | " -}}
{{- print "&nbsp;|&nbsp;" | safeHTML -}}
<span id="busuanzi_container_site_pv">
{{ printf `%s %s %s` .Site.Params.busuanziSitePVText $busuanziSitePVIcon `<span id="busuanzi_value_site_pv"></span>` | safeHTML }}
{{- with .Site.Params.busuanziSitePVText -}}
{{- $.Scratch.Set "busuanziSitePVText" (printf `%s&nbsp;` .) -}}
{{- else -}}
{{- $.Scratch.Set "busuanziSitePVText" "" -}}
{{- end -}}
{{- $busuanziSitePVText := .Scratch.Get "busuanziSitePVText" -}}
{{- with .Site.Params.busuanziSitePVIcon -}}
{{- $busuanziSitePVIcon := replace (index $.Site.Data.SVG $.Site.Params.busuanziSitePVIcon) "icon" "icon busuanzi-site-pv" -}}
{{- $.Scratch.Set "busuanziSitePVIcon" (printf `%s&nbsp;` $busuanziSitePVIcon) -}}
{{- else -}}
{{- $.Scratch.Set "busuanziSitePVIcon" "" -}}
{{- end -}}
{{- $busuanziSitePVIcon := .Scratch.Get "busuanziSitePVIcon" -}}
{{- printf `%s%s%s` $busuanziSitePVText $busuanziSitePVIcon `<span id="busuanzi_value_site_pv"></span>` | safeHTML -}}
</span>
</div>
{{ end }}
{{- end }}

{{ partial "custom/footer.html" . }}
</div>
Expand Down
16 changes: 8 additions & 8 deletions layouts/partials/post-meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<div class="post-meta">
{{ if and $Deliver.Site.Params.displayPublishedDate (not $Deliver.PublishDate.IsZero) }}
{{ $icon := replace (index $Deliver.Site.Data.SVG $Deliver.Site.Params.publishedDateIcon) "icon" "icon post-meta-icon" }}
{{ printf `<time datetime="%s" class="post-meta-item published">%s%s</time>` ($Deliver.PublishDate.Format "2006-01-02T15:04:05-07:00") $icon ($Deliver.PublishDate.Format $Deliver.Site.Params.postMetaDateFormat) | safeHTML }}
{{ printf `<time datetime="%s" class="post-meta-item published">%s&nbsp;%s</time>` ($Deliver.PublishDate.Format "2006-01-02T15:04:05-07:00") $icon ($Deliver.PublishDate.Format $Deliver.Site.Params.postMetaDateFormat) | safeHTML }}
{{ end }}
{{ if and $Deliver.Site.Params.displayModifiedDate (not $Deliver.Lastmod.IsZero) }}
{{ $icon := replace (index $Deliver.Site.Data.SVG $Deliver.Site.Params.modifiedDateIcon) "icon" "icon post-meta-icon" }}
{{ printf `<time datetime="%s" class="post-meta-item modified">%s%s</time>` ($Deliver.Lastmod.Format "2006-01-02T15:04:05-07:00") $icon ($Deliver.Lastmod.Format $Deliver.Site.Params.postMetaDateFormat) | safeHTML }}
{{ printf `<time datetime="%s" class="post-meta-item modified">%s&nbsp;%s</time>` ($Deliver.Lastmod.Format "2006-01-02T15:04:05-07:00") $icon ($Deliver.Lastmod.Format $Deliver.Site.Params.postMetaDateFormat) | safeHTML }}
{{ end }}
{{ if and $Deliver.Site.Params.displayExpiredDate (not $Deliver.ExpiryDate.IsZero) }}
{{ $icon := replace (index $Deliver.Site.Data.SVG $Deliver.Site.Params.expiredDateIcon) "icon" "icon post-meta-icon" }}
{{ printf `<time datetime="%s" class="post-meta-item expired">%s%s</time>` ($Deliver.ExpiryDate.Format "2006-01-02T15:04:05-07:00") $icon ($Deliver.ExpiryDate.Format $Deliver.Site.Params.postMetaDateFormat) | safeHTML }}
{{ printf `<time datetime="%s" class="post-meta-item expired">%s&nbsp;%s</time>` ($Deliver.ExpiryDate.Format "2006-01-02T15:04:05-07:00") $icon ($Deliver.ExpiryDate.Format $Deliver.Site.Params.postMetaDateFormat) | safeHTML }}
{{ end }}
{{ if $Deliver.Site.Params.displayCategory }}
{{ $icon := replace (index $Deliver.Site.Data.SVG $Deliver.Site.Params.categoryIcon) "icon" "icon post-meta-icon" | safeHTML }}
Expand All @@ -36,7 +36,7 @@
{{ with $sections }}
{{ $length := (sub (len $sections) 1) }}
<span class="post-meta-item category">
{{- $icon -}}
{{- printf `%s&nbsp;` $icon | safeHTML -}}
{{- range $link, $title := $sections -}}
{{- $index := $link | replaceRE `(\d+)/.+` `$1` | int -}}
{{- if lt $index $length -}}
Expand All @@ -54,7 +54,7 @@
{{ with $Deliver.Params.categories }}
{{ $length := sub (len .) 1 }}
<span class="post-meta-item category">
{{- $icon -}}
{{- printf `%s&nbsp;` $icon | safeHTML -}}
{{- range $index, $category := . -}}
{{- $url := urls.Parse ($category | urlize) -}}
{{- $path := $url.Path -}}
Expand All @@ -74,16 +74,16 @@
{{ end }}
{{ if $Deliver.Site.Params.displayWordCount }}
{{ $icon := replace (index $Deliver.Site.Data.SVG $Deliver.Site.Params.wordCountIcon) "icon" "icon post-meta-icon" | safeHTML }}
<span class="post-meta-item wordcount">{{ $icon }}{{ $Deliver.WordCount }}</span>
<span class="post-meta-item wordcount">{{ $icon }}&nbsp;{{ $Deliver.WordCount }}</span>
{{ end }}
{{ if $Deliver.Site.Params.displayReadingTime }}
{{ $icon := replace (index $Deliver.Site.Data.SVG $Deliver.Site.Params.readingTimeIcon) "icon" "icon post-meta-icon" | safeHTML }}
<span class="post-meta-item reading-time">{{ $icon }}{{ $Deliver.ReadingTime }}&nbsp;{{ i18n "minute" $Deliver.ReadingTime }}</span>
<span class="post-meta-item reading-time">{{ $icon }}&nbsp;{{ $Deliver.ReadingTime }}&nbsp;{{ i18n "minute" $Deliver.ReadingTime }}</span>
{{ end }}
{{ if and $Deliver.Site.Params.displayBusuanziPagePV (eq hugo.Environment "production") }}
{{ if not $isHome }}
{{ $icon := replace (index $Deliver.Site.Data.SVG $Deliver.Site.Params.busuanziPagePVIcon) "icon" "icon post-meta-icon" | safeHTML }}
<span class="post-meta-item busuanzi-page-pv" id="busuanzi_container_page_pv">{{ $icon }}<span id="busuanzi_value_page_pv"></span></span>
<span class="post-meta-item busuanzi-page-pv" id="busuanzi_container_page_pv">{{ $icon }}&nbsp;<span id="busuanzi_value_page_pv"></span></span>
{{ end }}
{{ end }}
</div>

0 comments on commit a4e4137

Please sign in to comment.