Skip to content

Commit

Permalink
Stop incomplete terms from showing up in search results and tag listi…
Browse files Browse the repository at this point in the history
…ng pages (#1292)

Signed-off-by: cjyabraham <cjyabraham@gmail.com>
  • Loading branch information
cjyabraham authored Sep 6, 2022
1 parent cfc745f commit f020498
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
3 changes: 2 additions & 1 deletion layouts/_default/taxonomy.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<h1 class="thin mb-5 pb-3">{{ with .Data.Singular }}{{ . | humanize }}: {{ end }}<span>{{title .Title }}</span></h1>
{{ .Content }}
<div class="articles-of-tag">
{{ range .Pages }}
{{ $pages := (where .Pages ".Params.status" "Completed") | union (where .Pages ".Params.status" "completed") -}}
{{ range sort $pages ".Title" }}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
<article class="article-teaser article-type-{{ with .Type }}{{ ( urlize . ) }}{{ end }}">
<h3><a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a></h3>
Expand Down
56 changes: 56 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{ hugo.Generator }}
{{- $outputFormat := partial "outputformat.html" . -}}

{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}

{{ $completed_status := or (eq .Params.status "Completed") (eq .Params.status "completed") }}

{{ if and hugo.IsProduction (ne $outputFormat "print") $completed_status -}}
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
{{ else -}}
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
{{ end -}}

{{ partialCached "favicons.html" . }}
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
<!-- for search engine optimization and third-party search engines like Elastic App Search-->
{{ if .Page.Description }}
<meta name="description" content="{{ .Page.Description }}">
{{ else }}
{{ $desc := (.Page.Content | safeHTML | truncate 150) }}
<meta name="description" content="{{ $desc }}">
{{ end }}

{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/google_news.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}

{{ partialCached "head-css.html" . "asdf" }}
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>
{{ if .Site.Params.offlineSearch }}
<script
src="https://unpkg.com/lunr@2.3.8/lunr.min.js"
integrity="sha384-vRQ9bDyE0Wnu+lMfm57BlYLO0/XauFuKpVsZPs7KEDwYKktWi5+Kz3MP8++DFlRY"
crossorigin="anonymous"></script>
{{end}}
{{ if .Site.Params.prism_syntax_highlighting }}
<!-- stylesheet for Prism -->
<link rel="stylesheet" href="{{ "/css/prism.css" | relURL }}"/>
{{ end }}
{{ partial "hooks/head-end.html" . }}
<!--To comply with GDPR, cookie consent scripts places in head-end must execute before Google Analytics is enabled -->
{{ if hugo.IsProduction }}
{{ if hasPrefix .Site.GoogleAnalytics "G-"}}
{{ template "_internal/google_analytics.html" . }}
{{ else }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
{{ end }}

0 comments on commit f020498

Please sign in to comment.