Compare commits

...

17 Commits

Author SHA1 Message Date
Haris 0e92a1e292
Merge 8bcc8379ed into 0989c28a0e 2023-12-16 13:33:06 -08:00
Aditya Telange 0989c28a0e
Allow aligning social-icons in homeInfo mode
In Site config
    homeInfoParams:
        AlignSocialIconsTo: "center" # or left or right
2023-12-16 21:40:14 +05:30
Aditya Telange fb1c0aeb6f
social icons refactor Params.socialIcons 2023-12-16 21:38:24 +05:30
Aditya Telange 69e5e085ab
improved profile mode spacing 2023-12-16 20:59:36 +05:30
Aditya Telange f8e125c7ee
Add padding to social-icons for better tap sizing 2023-12-16 20:59:08 +05:30
Aditya Telange 5f624757ae
Workflows: Update release bin path for hugo linux-amd64.deb 2023-12-16 20:07:15 +05:30
Aditya Telange e3ad0aeb70
Bump minimum Hugo version to 0.112.4
* language.LanguageCode is required for Fix/hugo depr 0.120.x #1328
2023-12-16 19:59:55 +05:30
Aditya Telange f51ad49819 replace .Site with site & fix whitespace 2023-12-16 19:43:59 +05:30
Joe Mooring ff7443b17f [PATCH] tpl/tplimpl: Fix deprecation logic in RSS template
cherry-pick from 23fcfb7f74
2023-12-16 19:43:59 +05:30
Joe Mooring 00488d0146 [PATCH] tpl/tplimpl: Deprecate .Site.Author usage in RSS template
cherry-pick from d4016dd5cd
2023-12-16 19:43:59 +05:30
Joe Mooring cf62fa3c40 [PATCH] tpl/tplimpl: Use .Language.LanguageCode in built-in templates
cherry-pick from ff77a927f9
2023-12-16 19:43:59 +05:30
Joe Mooring 87df659c18 [PATCH] tpl/tplimpl: Fix deprecation logic in embedded templates
cherry-picked from cb98e9061b
2023-12-16 19:43:59 +05:30
Joe Mooring 3fb112bc85 [PATCH] tpl/tplimpl: Deprecate .Site.Social usage with internal templates
cherry-picked from 4910312ee7
2023-12-16 19:43:59 +05:30
Razon Yang 102e089bc3 [PATCH] tpl/embedded: Make Open Graph's series optional
cherry-picked from b82b547acb
2023-12-16 19:43:59 +05:30
Aditya Telange 86362ebd72
Update README.md 2023-12-16 19:28:05 +05:30
Haris 8bcc8379ed
Merge branch 'master' into HarisDotParis-language-switch 2023-10-12 16:16:45 +02:00
Haris Trgo a0016f50f6 feat: new language switch behaviour, always listing all languages by weight but linking to translations if available
feat: if language switch shows language codes (instead of full language name), those codes are now uppercase
feat: translation list in post headers are replaced by links to translations in page headers - the old translation list in the post header can still be enabled using the boolean parameter "showTranslationListInPosts" (i.e. to turn it back on, add the parameter to your hugo.toml and set it to true)
2023-02-13 21:32:40 +01:00
16 changed files with 162 additions and 79 deletions

View File

@ -26,7 +26,7 @@ Please fill the template below
- Device/Os: [e.g. Android 10]
- Type: [e.g. Desktop/Mobile]
- Browser and version [e.g. Chrome 86.0]:
- Hugo Version [ >=0.97.1 expected]:
- Hugo Version [ >=0.112.4 expected]:
- Theme Version [e.g. v4.0, master, or commit-id ]:
**Steps to reproduce the behavior:**

View File

@ -15,7 +15,7 @@ on:
hugoVersion:
description: "Hugo Version"
required: false
default: "0.97.1"
default: "0.112.4"
# Allow one concurrent deployment
concurrency:
@ -38,14 +38,14 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: "0.97.1"
HUGO_VERSION: "0.112.4"
steps:
- name: Check version
if: ${{ github.event.inputs.hugoVersion }}
run: export HUGO_VERSION="${{ github.event.inputs.hugoVersion }}"
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb \
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Checkout
uses: actions/checkout@v3

View File

@ -3,7 +3,7 @@
<h4 align=center>☄️ Fast | ☁️ Fluent | 🌙 Smooth | 📱 Responsive</h4>
<br>
> Hugo PaperMod is a theme based on [hugo-paper](https://github.com/nanxiaobei/hugo-paper/tree/4330c8b12aa48bfdecbcad6ad66145f679a430b3).
> Hugo PaperMod is a theme based on [hugo-paper](https://github.com/nanxiaobei/hugo-paper/tree/4330c8b12aa48bfdecbcad6ad66145f679a430b3).<br>
> The goal of this project is to add more features and customization to the og theme.
**Documentation** can be found here: [**📚 Wiki**](https://github.com/adityatelange/hugo-PaperMod/wiki)
@ -11,10 +11,12 @@
**ExampleSite** can be found here: [**exampleSite**](https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite). Demo is built up with [exampleSite](https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite) as source.
[![hugo-papermod](https://img.shields.io/badge/Hugo--Themes-@PaperMod-blue)](https://themes.gohugo.io/themes/hugo-papermod/)
[![Minimum Hugo Version](https://img.shields.io/static/v1?label=HUGO-version&message=>0.97.1&color=blue&logo=hugo)](https://github.com/gohugoio/hugo/releases/tag/v0.97.1)
[![Minimum Hugo Version](https://img.shields.io/static/v1?label=min-HUGO-version&message=>=v0.112.4&color=blue&logo=hugo)](https://github.com/gohugoio/hugo/releases/tag/v0.112.4)
[![Discord](https://img.shields.io/discord/971046860317921340?label=Discord&logo=discord)](https://discord.gg/ahpmTvhVmp)
[![GitHub](https://img.shields.io/github/license/adityatelange/hugo-PaperMod)](https://github.com/adityatelange/hugo-PaperMod/blob/master/LICENSE)
![code-size](https://img.shields.io/github/languages/code-size/adityatelange/hugo-PaperMod)
[![X (formerly Twitter) URL](https://img.shields.io/badge/-Share%20on%20X-gray?style=flat&logo=x)](https://x.com/intent/tweet/?text=Checkout%20Hugo%20PaperMod%20%E2%9C%A8%0AA%20fast,%20clean,%20responsive%20Hugo%20theme.&url=https://github.com/adityatelange/hugo-PaperMod&hashtags=Hugo,PaperMod)
---
@ -36,7 +38,7 @@
- Social Icons (home-info and profile-mode)
- Social-Media Share buttons on posts.
- Menu location indicator.
- Multilingual support. (with language selector)
- Multilingual support (with improved language selector)
- Taxonomies
- Cover image for each post (with Responsive image support).
- Light/Dark theme (automatic theme switch a/c to browser theme and theme-switch button).

View File

@ -27,12 +27,10 @@
margin-inline-start: auto;
}
.social-icons {
padding: 12px 0;
}
.social-icons a:not(:last-of-type) {
margin-inline-end: 12px;
.social-icons a {
display: inline-flex;
padding: 10px;
}
.social-icons a svg {

View File

@ -10,19 +10,20 @@
text-align: center;
}
.profile .profile_inner h1 {
padding: 12px 0;
.profile .profile_inner {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.profile img {
display: inline-table;
border-radius: 50%;
}
.buttons {
flex-wrap: wrap;
max-width: 400px;
margin: 0 auto;
}
.button {

View File

@ -1,5 +1,5 @@
{{- if lt hugo.Version "0.97.1" }}
{{- errorf "=> hugo v0.97.1 or greater is required for hugo-PaperMod to build " }}
{{- if lt hugo.Version "0.112.4" }}
{{- errorf "=> hugo v0.112.4 or greater is required for hugo-PaperMod to build " }}
{{- end -}}
<!DOCTYPE html>

View File

@ -1,21 +1,53 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
{{- $authorEmail := "" }}
{{- with site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .email }}
{{- $authorEmail = . }}
{{- end }}
{{- end }}
{{- else }}
{{- with site.Author.email }}
{{- $authorEmail = . }}
{{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
{{- end }}
{{- end }}
{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
{{- $authorName := "" }}
{{- with site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .name }}
{{- $authorName = . }}
{{- end }}
{{- else }}
{{- $authorName = . }}
{{- end }}
{{- else }}
{{- with site.Author.name }}
{{- $authorName = . }}
{{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
{{- end }}
{{- end }}
{{- $pctx := . }}
{{- if .IsHome }}{{ $pctx = site }}{{ end }}
{{- $pages := slice }}
{{- if or $.IsHome $.IsSection }}
{{- $pages = $pctx.RegularPages }}
{{- else }}
{{- $pages = $pctx.Pages }}
{{- end }}
{{- $limit := site.Config.Services.RSS.Limit }}
{{- if ge $limit 1 }}
{{- $pages = $pages | first $limit }}
{{- end }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ site.Title }}{{ end }}</title>
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ site.Title }}</description>
<description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }}</description>
{{- with site.Params.images }}
<image>
<title>{{ site.Title }}</title>
@ -23,22 +55,22 @@
<link>{{ index . 0 | absURL }}</link>
</image>
{{- end }}
<generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with site.Author.email }}
<managingEditor>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with site.Author.email }}
<webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<generator>Hugo -- gohugo.io</generator>
<language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
<managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
{{- with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
{{- end }}
{{- range $pages }}
{{- if and (ne .Layout `search`) (ne .Layout `archives`) }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with site.Author.email }}<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>{{end}}
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid>
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
{{- if site.Params.ShowFullTextinRSS }}
@ -46,6 +78,6 @@
{{- end }}
</item>
{{- end }}
{{ end }}
{{- end }}
</channel>
</rss>

View File

@ -13,10 +13,10 @@
{{ .Description }}
</div>
{{- end }}
{{- if not (.Param "hideMeta") }}
<div class="post-meta">
{{- partial "translation_list.html" . -}}
</div>
{{- if and (.Param "showTranslationListInPosts") (not (.Param "hideMeta")) }}
<div class="post-meta">
{{- partial "translation_list.html" . -}}
</div>
{{- end }}
</header>

View File

@ -22,7 +22,9 @@
{{- if not (.Param "hideMeta") }}
<div class="post-meta">
{{- partial "post_meta.html" . -}}
{{- partial "translation_list.html" . -}}
{{- if .Param "showTranslationListInPosts" }}
{{- partial "translation_list.html" . -}}
{{- end }}
{{- partial "edit_post.html" . -}}
{{- partial "post_canonical.html" . -}}
</div>

View File

@ -96,27 +96,42 @@
</button>
{{- end }}
{{- $lang := .Lang}}
{{- $separator := or $label_text (not site.Params.disableThemeToggle)}}
{{- with site.Home.AllTranslations }}
<ul class="lang-switch">
{{- if $separator }}<li>|</li>{{ end }}
{{- range . -}}
{{- if ne $lang .Lang }}
<li>
<a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}"
aria-label="{{ .Language.LanguageName | default (.Lang | title) }}">
{{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify -}}
{{- else }}
{{- .Lang | title -}}
{{- end -}}
</a>
</li>
{{- end -}}
{{- end}}
</ul>
{{- end }}
{{/* LANGUAGE SELECTOR */}}
{{ if .Site.IsMultiLingual }}
{{/* set vars with page data */}}
{{ $currentLang := .Lang }}
{{ $allTranslations := .Translations }}
{{ $separator := or $label_text (not site.Params.disableThemeToggle)}}
<ul class="lang-switch">
{{ if $separator }}<li>|</li>{{ end }}
{{ range $anySiteLang := .Site.Home.AllTranslations }}
{{/* code here can only access page-related data via vars set above */}}
{{ if ne $currentLang $anySiteLang.Lang }}
{{ $translationLink := .Permalink }}
{{ range $translation := $allTranslations }}
{{ if eq $anySiteLang.Lang $translation.Lang }}
{{ $translationLink = $translation.Permalink }}
{{ end }}
{{ end }}
<li>
<a href="{{ $translationLink }}"
title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName ) | default (.Lang | upper) }}"
aria-label="{{ .Language.LanguageName | default (.Lang | upper) }}">
{{ if site.Params.DisplayFullLangName }}
{{ .Language.LanguageName }}
{{ else }}
{{ .Lang | upper }}
{{ end }}
</a>
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}
</div>
</div>
{{- $currentPage := . }}

View File

@ -7,7 +7,7 @@
{{ .Content | markdownify }}
</div>
<footer class="entry-footer">
{{ partial "social_icons.html" site.Params.socialIcons }}
{{ partial "social_icons.html" (dict "align" site.Params.homeInfoParams.AlignSocialIconsTo) }}
</footer>
</article>
{{- end -}}

View File

@ -32,7 +32,7 @@
{{- end }}
<h1>{{ .title | default site.Title | markdownify }}</h1>
<span>{{ .subtitle | markdownify }}</span>
{{- partial "social_icons.html" site.Params.socialIcons -}}
{{- partial "social_icons.html" -}}
{{- with .buttons }}
<div class="buttons">

View File

@ -1,6 +1,7 @@
<div class="social-icons">
{{- range . }}
<a href="{{ trim .url " " | safeURL }}" target="_blank" rel="noopener noreferrer me" title="{{ (.title | default .name) | title }}">
<div class="social-icons" {{ with .align}}align="{{.}}" {{- end }}>
{{- range site.Params.socialIcons }}
<a href="{{ trim .url " " | safeURL }}" target="_blank" rel="noopener noreferrer me"
title="{{ (.title | default .name) | title }}">
{{ partial "svg.html" . }}
</a>
{{- end }}

View File

@ -41,12 +41,27 @@
{{- /* If it is part of a series, link to related articles */}}
{{- $permalink := .Permalink }}
{{- $siteSeries := site.Taxonomies.series }}
{{- if $siteSeries }}
{{ with .Params.series }}{{- range $name := . }}
{{- $series := index $siteSeries ($name | urlize) }}
{{- range $page := first 6 $series.Pages }}
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
{{- end }}
{{ end }}{{ end }}
{{- end }}
{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
{{- $facebookAdmin := "" }}
{{- with site.Params.social }}
{{- if reflect.IsMap . }}
{{- $facebookAdmin = .facebook_admin }}
{{- end }}
{{- else }}
{{- with site.Social.facebook_admin }}
{{- $facebookAdmin = . }}
{{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
{{- end }}
{{- end }}
{{- /* Facebook Page Admin ID for Domain Insights */}}
{{- with site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}

View File

@ -28,6 +28,23 @@
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end -}}
{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
{{- $twitterSite := "" }}
{{- with site.Params.social }}
{{- if reflect.IsMap . }}
{{- $twitterSite = .twitter }}
{{- end }}
{{- else }}
{{- with site.Social.twitter }}
{{- $twitterSite = . }}
{{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
{{- end }}
{{- end }}
{{- with $twitterSite }}
{{- $content := . }}
{{- if not (strings.HasPrefix . "@") }}
{{- $content = printf "@%v" $twitterSite }}
{{- end }}
<meta name="twitter:site" content="{{ $content }}"/>
{{- end }}

View File

@ -37,7 +37,7 @@ features = [
"scroll-to-top",
"search"
]
min_version = "0.97.1"
min_version = "0.112.4"
[author]
name = "Aditya Telange"