Skip to content

Commit

Permalink
cover.html 加入文章網址、裁切功能
Browse files Browse the repository at this point in the history
  • Loading branch information
letswritetw committed Jul 14, 2022
1 parent bd9b164 commit aa1335d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions layouts/partials/cover.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{{ with .Resources.GetMatch (print .Params.cover) }}
<img
src="{{ .RelPermalink }}" alt="{{ .Title }}"
width="{{ .Width }}" height="{{ .Height }}">
{{ $Uri := .RelPermalink }}
{{ $Image := .Resources.GetMatch (print .Params.cover) }}
{{ $ImageResize := $Image.Resize "768x" }}
{{ with $Image }}
<div>
<a href="{{ $Uri }}">
<img
class="block"
src="{{ $ImageResize.RelPermalink }}" alt="{{ .Title }}"
width="{{ $ImageResize.Width }}" height="{{ $ImageResize.Height }}">
</a>
</div>
{{ end }}

0 comments on commit aa1335d

Please sign in to comment.