Skip to content

Commit

Permalink
feat:add cover link
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfa committed Nov 15, 2024
1 parent 38cb430 commit e839259
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ echo "theme = 'farallon'" >> hugo.toml

## Release Notes

### 0.4.8

- add cover link

### 0.4.7

- compatible with the latest version
Expand Down
4 changes: 4 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ echo "theme = 'farallon'" >> hugo.toml

## Release Note

### 0.4.8

- 增加封面链接

### 0.4.7

- 兼容最新版本
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ <h2 class="post--title" itemprop="headline">
{{ if .Content }}
{{ $urls := findRE "<img src=\"[^\"|\\\"]*\"" .Content }} {{ if $urls }} {{ $url :=index ($urls) 0 }} {{ $url
:=(strings.TrimPrefix "<img src=\"" $url) }}
{{ $url := strings.TrimRight " \"" $url }} <img src="{{ $url }}" class="cover" itemprop="image" /> {{ end }} {{
{{ $url := strings.TrimRight " \"" $url }} <a href="{{ .Permalink }}" aria-label="{{ .Title }}"
class="cover--link"><img src="{{ $url }}" class="cover" itemprop="image" /></a> {{ end }} {{
end }}
</article>

0 comments on commit e839259

Please sign in to comment.