diff options
-rw-r--r-- | assets/templates/markdown-feed.yaml | 2 | ||||
-rw-r--r-- | themes/default/layouts/partials/author-picture.html | 14 | ||||
-rw-r--r-- | themes/default/layouts/partials/card-feed.html | 82 | ||||
-rw-r--r-- | themes/default/layouts/partials/context-profile.html | 14 | ||||
-rw-r--r-- | themes/default/layouts/partials/feeds-generate.html | 27 | ||||
-rw-r--r-- | themes/default/layouts/partials/profile-picture.html | 3 |
6 files changed, 55 insertions, 87 deletions
diff --git a/assets/templates/markdown-feed.yaml b/assets/templates/markdown-feed.yaml index afb8c8a..c0337b5 100644 --- a/assets/templates/markdown-feed.yaml +++ b/assets/templates/markdown-feed.yaml @@ -19,4 +19,4 @@ feed: {{ end -}} --- -{{ .content }} +{{ .content }} [Read More →]({{ .link }}) diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html index b8e5489..326708a 100644 --- a/themes/default/layouts/partials/author-picture.html +++ b/themes/default/layouts/partials/author-picture.html @@ -1,10 +1,24 @@ {{- $file := "/profile/picture.png" -}} {{- $image := imageConfig (print "content/" (partial "author-media-path.html" .) $file) -}} +{{- with .Params.feed -}} +{{ else }} +<source srcset="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}/profile/picture.png" type="image/png" /> +<source srcset="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}/profile/picture.jpg" type="image/jpeg" /> +<source srcset="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}/profile/picture.webp" type="image/webp" /> +{{ end }} + <img loading="lazy" + {{- with .Params.feed -}} + width="64" + height="64" + alt="{{ .name }}" + src="{{ $.Site.BaseURL }}{{ .image }}" + {{ else }} width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ partial "author-name.html" . }}" src="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}{{ $file }}" + {{ end }} /> diff --git a/themes/default/layouts/partials/card-feed.html b/themes/default/layouts/partials/card-feed.html deleted file mode 100644 index a19ce78..0000000 --- a/themes/default/layouts/partials/card-feed.html +++ /dev/null @@ -1,82 +0,0 @@ -<micro-card> - <micro-summary> - <micro-thumbnail> - - {{- $imageCanonicalURL := (print "https://" .FeedSourceDomain "/favicon.ico") -}} - {{- $imageTitle := "No image found" -}} - {{- $imageSource := "/images/404.png" -}} - - {{- with $image := resources.GetRemote $imageCanonicalURL -}} - {{- with .Err -}} - {{ warnf "%s" . }} - {{- $fallbackImage := imageConfig (print "static/images/404.png") -}} - {{- with $fallbackImage -}} - {{- $fallbackWidth := .Width -}} - {{- $fallbackHeight := .Height -}} - {{ end }} - {{- else -}} - {{- $imageTitle = $imageCanonicalURL -}} - {{- $imageSource = $image.RelPermalink -}} - {{ end }} - <figure> - <a title="{{ $imageTitle }}" href=" {{ $imageSource }}"> - <picture> - <img alt="" src="{{ $imageSource }}" /> - </picture> - </a> - </figure> - {{ else }} - <figure> - <a title="{{ $imageTitle }}" href=" {{ $imageSource }}"> - <picture> - <img alt="" src="{{ $imageSource }}" /> - </picture> - </a> - </figure> - {{ end }} - - </micro-thumbnail> - - <micro-content> - <micro-metadata> - <micro-thumbnail hidden> - <figure> - <a title="{{ $imageTitle }}" href=" {{ $imageSource }}"> - <picture> - <img alt="" src="{{ $imageSource }}" /> - </picture> - </a> - </figure> - </micro-thumbnail> - <section> - <b>{{ .FeedName }}</b> - - · <a - title="{{ .FeedSourceLink }}" - rel="noopener" - target="_blank" - href="{{ .FeedSourceLink }}"> - @{{ .FeedSourceDomain }} - </a> - - · <a href="{{ .FeedLink }}"> - <time - datetime="{{ .FeedDateTime }}" - title="{{ .FeedDateTitle }}"> - {{ .FeedDate }} - </time> - </a> - - · {{- partial "read-time.html" (dict "WordCount" .FeedWordCount) -}} - - · <word-limit> - <word-count title="{{ .FeedWordCount }} words"> - {{ .FeedWordCount }} words - </word-count> - </word-limit> - </section> - </micro-metadata> - <p>{{ .FeedContent }}</p> - </micro-content> - </micro-summary> -</micro-card> diff --git a/themes/default/layouts/partials/context-profile.html b/themes/default/layouts/partials/context-profile.html index 4124a8b..dad9f33 100644 --- a/themes/default/layouts/partials/context-profile.html +++ b/themes/default/layouts/partials/context-profile.html @@ -11,7 +11,19 @@ <a title="{{ $author.name }}" href="{{ .Site.BaseURL }}/{{ $author.user }}"> {{- end -}} <picture> - <img alt="{{ $author.name }}" src="{{ .Site.BaseURL }}/{{ $author.user }}/media/profile/picture.png" /> + {{- with .Params.feed -}} + <img + width="64" + height="64" + alt="{{ .name }}" + src="{{ $.Site.BaseURL }}{{ .image }}" + /> + {{ else }} + <img + alt="{{ $author.name }}" + src="{{ .Site.BaseURL }}/{{ $author.user }}/media/profile/picture.png" + /> + {{ end }} </picture> </a> </figure> diff --git a/themes/default/layouts/partials/feeds-generate.html b/themes/default/layouts/partials/feeds-generate.html index d66427c..382de47 100644 --- a/themes/default/layouts/partials/feeds-generate.html +++ b/themes/default/layouts/partials/feeds-generate.html @@ -101,6 +101,32 @@ {{ end }} {{ range $feeds }} + + {{- $imageCanonicalURL := + (print + "https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=" + "http://" + .FeedSourceDomain + "&size=64" + ) + -}} + {{- $imageSource := "/images/404.png" -}} + {{- $imageTitle := "No image found" -}} + + {{- with $image := resources.GetRemote $imageCanonicalURL -}} + {{- with .Err -}} + {{ warnf "%s" . }} + {{- $fallbackImage := imageConfig (print "static/images/404.png") -}} + {{- with $fallbackImage -}} + {{- $fallbackWidth := .Width -}} + {{- $fallbackHeight := .Height -}} + {{ end }} + {{- else -}} + {{- $imageTitle = $imageCanonicalURL -}} + {{- $imageSource = $image.RelPermalink -}} + {{ end }} + {{ end }} + {{ $template := resources.Get "templates/markdown-feed.yaml" }} {{ $name := urlize (replace .FeedTitle "/" "-") }} {{ $path := print "/data/generates/content/" $author.user "/feeds/" $name ".md" }} @@ -122,6 +148,7 @@ "raw" (strings.TrimLeft "/" $path) "self" (print $author.user "/feeds/" $name "/") "tags" "[rss]" + "image" $imageSource ) $template }} diff --git a/themes/default/layouts/partials/profile-picture.html b/themes/default/layouts/partials/profile-picture.html index 8e75769..6b56e95 100644 --- a/themes/default/layouts/partials/profile-picture.html +++ b/themes/default/layouts/partials/profile-picture.html @@ -1,8 +1,5 @@ <figure> <picture> - <source srcset="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}/profile/picture.png" type="image/png" /> - <source srcset="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}/profile/picture.jpg" type="image/jpeg" /> - <source srcset="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}/profile/picture.webp" type="image/webp" /> {{ partial "author-picture.html" . }} </picture> {{ partial "context-profile.html" . }} |