Skip to content

Commit

Permalink
Optimize pages for SEO
Browse files Browse the repository at this point in the history
  • Loading branch information
cntrump committed Jan 22, 2025
1 parent 6e42337 commit 5a0e771
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<span class="image-container"><span class="link">
{{- end -}}
<img loading="lazy" {{ if $block }}class="img"{{ end }} src="{{- $url -}}"
alt{{- with .Text -}}="{{- . -}}" {{- end -}}/>
alt="{{- with .Text -}}{{- . -}}{{- end -}}"/>
{{- if $block -}}
</span>
{{- if ne .Title " " -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="article-container">
{{- partial "article-header.html" . -}}
<article class="article markdown-body" {{- if $justify -}}style="text-align: justify;" {{- end -}}>
{{- with .Params.cover -}}<p><img loading="lazy" class="cover" src="{{- . | safeURL -}}"/></p>{{- end -}}
{{- with .Params.cover -}}<p><img alt="" loading="lazy" class="cover" src="{{- . | safeURL -}}"/></p>{{- end -}}
{{- .Content -}}
</article>

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/article-author.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{- with $profile -}}
{{- if eq .enable true -}}
<section class="article author">
{{- with .avatar -}}<img loading="lazy" class="avatar" src="{{- . | relURL -}}"/>{{- end -}}
{{- with .avatar -}}<img alt="" loading="lazy" class="avatar" src="{{- . | relURL -}}"/>{{- end -}}

{{- with .name -}}<p class="name">{{- . -}}</p>{{- end -}}

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/beian.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- if or .gongan .icp -}}
<p style="font-size: 12px;">
{{- if .gongan -}}
<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode={{- .code -}}" target="_blank" rel="noopener noreferrer"><img loading="lazy" style="vertical-align: text-bottom; width: 15px; height: 15px;" src={{- "/assets/img/gonganlogo.png" | relURL -}}/>{{- .gongan -}}</a>
<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode={{- .code -}}" target="_blank" rel="noopener noreferrer"><img alt="" loading="lazy" style="vertical-align: text-bottom; width: 15px; height: 15px;" src={{- "/assets/img/gonganlogo.png" | relURL -}}/>{{- .gongan -}}</a>
&nbsp;&nbsp;&nbsp;&nbsp;
{{- end -}}

Expand Down
13 changes: 13 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">

{{- $description := "" -}}
{{- if .IsPage -}}
{{- if .Params.Description -}}
{{- $description = .Params.Description -}}
{{- else -}}
{{- $description = .Summary -}}
{{- end -}}
{{- else if .Params.Description -}}
{{- $description = .Params.Description -}}
{{- else -}}
{{- $description = .Site.Params.Description -}}
{{- end -}}
<meta name="description" content="{{- $description -}}">
{{- define "title" -}}
{{- $title := .Title -}}
{{- if and (ne $title "") (ne $title site.Title) -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="header wrap"><span class="header left-side"><a class="site home" href="{{- `` | relLangURL -}}">
{{- $logo := site.Params.logo -}}
{{- if $logo -}}
<img loading="lazy" class="site logo" src="{{- $logo | relURL -}}"/>
<img alt="" loading="lazy" class="site logo" src="{{- $logo | relURL -}}"/>
{{- end -}}
<span class="site name">{{- site.Title | safeHTML -}}</span></a></span>
<span class="header right-side">
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/note-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{{- if and (not (hasPrefix $imgurl "http://")) (not (hasPrefix $imgurl "https://")) -}}
{{- $imgurl := path.Join $relURL . -}}
{{- end -}}
<img loading="lazy" class="img" src="{{- $imgurl -}}"/>
<img alt="" loading="lazy" class="img" src="{{- $imgurl -}}"/>
{{- end -}}
</span>
{{- end -}}
Expand Down
4 changes: 1 addition & 3 deletions layouts/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
User-agent: *
Disallow:
Sitemap: /sitemap.xml
User-agent: *

0 comments on commit 5a0e771

Please sign in to comment.