1
0
Fork 0

simplify code

This commit is contained in:
nanxiaobei 2020-03-10 01:50:02 +08:00
parent 33ba819d7e
commit bcfd902a30
2 changed files with 9 additions and 20 deletions

View file

@ -1,25 +1,21 @@
{{- partial "header.html" . }} {{- partial "header.html" . }}
{{- $scope := . }} {{- $scope := .Site }}
{{- if .IsHome }} {{- if .Title }}
{{- $scope = .Site }} <header class="page-header"><h1>{{ .Title }}</h1></header>{{ $scope = . }}
{{- else }} {{ end }}
<header class="page-header">
<h1>{{ if .Data.Term }}{{ .Data.Term }}{{ else }}Tags{{ end }}</h1>
</header>
{{- end }}
{{- $paginator := .Paginate (where $scope.RegularPages ".Params.type" "!=" "page") }} {{- $paginator := .Paginate (where $scope.RegularPages ".Params.type" "!=" "page") }}
{{- range $index, $page := $paginator.Pages }} {{- range $index, $page := $paginator.Pages }}
{{- $entryClass := "post-entry" }} {{- $class := "post-entry" }}
{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0)) }} {{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0)) }}
{{- $entryClass = "first-entry" }} {{- $class = "first-entry" }}
{{- else if .Data.Term }} {{- else if .Data.Term }}
{{- $entryClass = "post-entry tag-entry" }} {{- $class = "post-entry tag-entry" }}
{{- end }} {{- end }}
<article class="{{ $entryClass }}"> <article class="{{ $class }}">
<header class="entry-header"> <header class="entry-header">
<h2>{{ .Title }}</h2> <h2>{{ .Title }}</h2>
</header> </header>

View file

@ -5,14 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Title --> <!-- Title -->
<title> <title>{{ if .Title }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
{{- if not .IsHome }}
{{- if eq .Kind "page" }}{{ .Title }}{{ else if .Data.Term }}{{ .Data.Term }}{{ else }}Tags{{ end }}
{{- print " - " }}
{{- end }}
{{- .Site.Title -}}
</title>
<!-- Meta --> <!-- Meta -->
{{- if eq .Kind "page" }} {{- if eq .Kind "page" }}
<meta name="description" content="{{ .Summary }}"> <meta name="description" content="{{ .Summary }}">