|
| 1 | +{{- define "main" }} |
| 2 | + |
| 3 | +{{- if (and site.Params.profileMode.enabled .IsHome) }} |
| 4 | +{{- partial "index_profile.html" . }} |
| 5 | +{{- else }} {{/* if not profileMode */}} |
| 6 | + |
| 7 | +{{- if not .IsHome | and .Title }} |
| 8 | +<header class="page-header"> |
| 9 | + {{- partial "breadcrumbs.html" . }} |
| 10 | + <h1> |
| 11 | + {{ .Title }} |
| 12 | + {{- if and (or (eq .Kind `term`) (eq .Kind `section`)) (.Param "ShowRssButtonInSectionTermList") }} |
| 13 | + {{- with .OutputFormats.Get "rss" }} |
| 14 | + <a href="{{ .RelPermalink }}" title="RSS" aria-label="RSS"> |
| 15 | + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" |
| 16 | + stroke-linecap="round" stroke-linejoin="round" height="23"> |
| 17 | + <path d="M4 11a9 9 0 0 1 9 9" /> |
| 18 | + <path d="M4 4a16 16 0 0 1 16 16" /> |
| 19 | + <circle cx="5" cy="19" r="1" /> |
| 20 | + </svg> |
| 21 | + </a> |
| 22 | + {{- end }} |
| 23 | + {{- end }} |
| 24 | + </h1> |
| 25 | + {{- if .Description }} |
| 26 | + <div class="post-description"> |
| 27 | + {{ .Description | markdownify }} |
| 28 | + </div> |
| 29 | + {{- end }} |
| 30 | +</header> |
| 31 | +{{- end }} |
| 32 | + |
| 33 | +{{- if .Content }} |
| 34 | +<div class="post-content"> |
| 35 | + {{- if not (.Param "disableAnchoredHeadings") }} |
| 36 | + {{- partial "anchored_headings.html" .Content -}} |
| 37 | + {{- else }}{{ .Content }}{{ end }} |
| 38 | +</div> |
| 39 | +{{- end }} |
| 40 | + |
| 41 | +{{- $pages := union .RegularPages .Sections }} |
| 42 | + |
| 43 | +{{- if .IsHome }} |
| 44 | +{{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }} |
| 45 | +{{- $pages = where $pages "Params.hiddenInHomeList" "!=" "true" }} |
| 46 | +{{- end }} |
| 47 | + |
| 48 | +{{- $paginator := .Paginate $pages }} |
| 49 | + |
| 50 | +{{- /* One h1 on home when not using homeInfoParams (theme default omits page-header for .IsHome). */ -}} |
| 51 | +{{- if and .IsHome (not site.Params.homeInfoParams) }} |
| 52 | +<header class="page-header home-intro"> |
| 53 | + <h1>{{ site.Title }}</h1> |
| 54 | +</header> |
| 55 | +{{- end }} |
| 56 | + |
| 57 | +{{- if and .IsHome site.Params.homeInfoParams (eq $paginator.PageNumber 1) }} |
| 58 | +{{- partial "home_info.html" . }} |
| 59 | +{{- end }} |
| 60 | + |
| 61 | +{{- $term := .Data.Term }} |
| 62 | +{{- range $index, $page := $paginator.Pages }} |
| 63 | + |
| 64 | +{{- $class := "post-entry" }} |
| 65 | + |
| 66 | +{{- $user_preferred := or site.Params.disableSpecial1stPost site.Params.homeInfoParams }} |
| 67 | +{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }} |
| 68 | +{{- $class = "first-entry" }} |
| 69 | +{{- else if $term }} |
| 70 | +{{- $class = "post-entry tag-entry" }} |
| 71 | +{{- end }} |
| 72 | + |
| 73 | +<article class="{{ $class }}"> |
| 74 | + {{- $isHidden := (.Param "cover.hiddenInList") | default (.Param "cover.hidden") | default false }} |
| 75 | + {{- partial "cover.html" (dict "cxt" . "IsHome" $.IsHome "isHidden" $isHidden) }} |
| 76 | + <header class="entry-header"> |
| 77 | + <h2 class="entry-hint-parent"> |
| 78 | + {{- .Title }} |
| 79 | + {{- if .Draft }} |
| 80 | + <span class="entry-hint" title="Draft"> |
| 81 | + <svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" fill="currentColor"> |
| 82 | + <path |
| 83 | + d="M160-410v-60h300v60H160Zm0-165v-60h470v60H160Zm0-165v-60h470v60H160Zm360 580v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q9 9 13 20t4 22q0 11-4.5 22.5T862.09-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z" /> |
| 84 | + </svg> |
| 85 | + </span> |
| 86 | + {{- end }} |
| 87 | + </h2> |
| 88 | + </header> |
| 89 | + {{- if (ne (.Param "hideSummary") true) }} |
| 90 | + <div class="entry-content"> |
| 91 | + <p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p> |
| 92 | + </div> |
| 93 | + {{- end }} |
| 94 | + {{- if not (.Param "hideMeta") }} |
| 95 | + <footer class="entry-footer"> |
| 96 | + {{- partial "post_meta.html" . -}} |
| 97 | + </footer> |
| 98 | + {{- end }} |
| 99 | + <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a> |
| 100 | +</article> |
| 101 | +{{- end }} |
| 102 | + |
| 103 | +{{- if gt $paginator.TotalPages 1 }} |
| 104 | +<footer class="page-footer"> |
| 105 | + <nav class="pagination"> |
| 106 | + {{- if $paginator.HasPrev }} |
| 107 | + <a class="prev" href="{{ $paginator.Prev.URL | absURL }}"> |
| 108 | + « {{ i18n "prev_page" }} |
| 109 | + {{- if (.Param "ShowPageNums") }} |
| 110 | + {{- sub $paginator.PageNumber 1 }}/{{ $paginator.TotalPages }} |
| 111 | + {{- end }} |
| 112 | + </a> |
| 113 | + {{- end }} |
| 114 | + {{- if $paginator.HasNext }} |
| 115 | + <a class="next" href="{{ $paginator.Next.URL | absURL }}"> |
| 116 | + {{- i18n "next_page" }} |
| 117 | + {{- if (.Param "ShowPageNums") }} |
| 118 | + {{- add 1 $paginator.PageNumber }}/{{ $paginator.TotalPages }} |
| 119 | + {{- end }} » |
| 120 | + </a> |
| 121 | + {{- end }} |
| 122 | + </nav> |
| 123 | +</footer> |
| 124 | +{{- end }} |
| 125 | + |
| 126 | +{{- end }}{{/* end profileMode */}} |
| 127 | + |
| 128 | +{{- end }}{{- /* end main */ -}} |
0 commit comments