Skip to content

Commit

Permalink
Add search index (#1777)
Browse files Browse the repository at this point in the history
* Added search index for 2.15 docs

Signed-off-by: Travis Beckham <[email protected]>

* Tweaks

Signed-off-by: Travis Beckham <[email protected]>

* Added search index to robots.txt; Moved search index to root

Signed-off-by: Travis Beckham <[email protected]>

* Fixed deprecated .Site.IsServer

Signed-off-by: Travis Beckham <[email protected]>

* Removed unsused redirect output

Signed-off-by: Travis Beckham <[email protected]>

* Bumped Hugo version

Signed-off-by: Travis Beckham <[email protected]>

---------

Signed-off-by: Travis Beckham <[email protected]>
  • Loading branch information
travisbeckham committed May 17, 2024
1 parent eb40950 commit 9b214af
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/on-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
cd $(mktemp -d)

# hugo
scurl -O https://github.com/gohugoio/hugo/releases/download/v0.121.2/hugo_extended_0.121.2_linux-amd64.deb
scurl -O https://github.com/gohugoio/hugo/releases/download/v0.126.1/hugo_extended_0.126.1_linux-amd64.deb
sudo dpkg -i hugo*.deb
rm hugo*.deb

Expand Down
2 changes: 0 additions & 2 deletions linkerd.io/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ description: Linkerd adds critical security, observability, and reliability to y
Kubernetes stack, without any code changes.
keywords:
- cloud native applications
outputs:
- html
top_hero:
title: The world's most advanced service mesh
description: Enterprise power *without* enterprise complexity. Linkerd adds
Expand Down
19 changes: 11 additions & 8 deletions linkerd.io/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ ignoreErrors = ["error-remote-getjson"]
paginate = 10
baseurl = "https://linkerd.io/"
disableKinds = ["taxonomy", "term"]
enableRobotsTXT = true
languageCode = "en-US"
sectionPagesMenu = "main"
theme = "buoyant"
Expand Down Expand Up @@ -85,14 +84,18 @@ title = "Linkerd"
identifier = "join-forum"
name = "Join Forum"
url = "https://linkerd.buoyant.io"
[outputFormats.REDIRECTS]
baseName = "_redirects"
mediaType = "text/netlify"
[outputFormats.RSS]
mediatype = "application/RSS"
baseName = "feed"
[outputFormats]
[outputFormats.REDIRECTS]
baseName = "_redirects"
mediaType = "text/netlify"
[outputFormats.RSS]
mediaType = "application/rss+xml"
baseName = "feed"
[outputFormats.SearchIndex]
mediaType = "application/json"
baseName = "search"
[outputs]
home = ["HTML", "RSS", "REDIRECTS"]
home = ["HTML", "SearchIndex"]
section = ["HTML", "RSS", "JSON"]
[params]
description = "Linkerd is an ultralight service mesh for Kubernetes. It gives you observability, reliability, and security without requiring any code changes."
Expand Down
2 changes: 1 addition & 1 deletion linkerd.io/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</head>

<body class="has-background-grey-light has-navbar-fixed-top ">
{{ if not .Site.IsServer }}
{{ if not hugo.IsServer }}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PXBDGKJ" height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript>
Expand Down
18 changes: 18 additions & 0 deletions linkerd.io/layouts/index.searchindex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- $pages := where site.Pages "Section" "eq" "2.15" -}}
[
{{- range $index, $page := $pages -}}
{{- if gt $index 0 -}} , {{- end -}}
{{- $ancestors := slice "linkerd.io" -}}
{{- range .Ancestors.Reverse -}}
{{- if .IsHome }}{{ continue }}{{ end -}}
{{- $ancestors = $ancestors | append .Title -}}
{{- end -}}
{{- $entry := dict "uri" $page.Permalink -}}
{{- $entry = merge $entry (dict "title" $page.Title) -}}
{{- $entry = merge $entry (dict "ancestors" $ancestors) -}}
{{- $entry = merge $entry (dict "content" ($page.Plain | htmlUnescape | truncate 3000)) -}}
{{- $entry = merge $entry (dict "description" $page.Description) -}}
{{- $entry = merge $entry (dict "keywords" $page.Keywords) -}}
{{- $entry | jsonify -}}
{{- end -}}
]
2 changes: 1 addition & 1 deletion linkerd.io/layouts/partials/css.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ $inServerMode := site.IsServer }}
{{ $inServerMode := hugo.IsServer }}
{{ $useMaterial := .Page.Params.use_material }}
{{ if $useMaterial }}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/4.0.2/bootstrap-material-design.css" />
Expand Down
4 changes: 4 additions & 0 deletions linkerd.io/static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *

Disallow: https://slack.linkerd.io/
Disallow: /search.json
2 changes: 1 addition & 1 deletion linkerd.io/themes/buoyant/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</head>

<body class="has-background-grey-light">
{{ if not .Site.IsServer }}
{{ if not hugo.IsServer }}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PXBDGKJ" height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript>
Expand Down
2 changes: 1 addition & 1 deletion linkerd.io/themes/buoyant/layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lazysizes/4.1.5/lazysizes.min.js"></script>

{{ if not .Site.IsServer }}
{{ if not hugo.IsServer }}
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
Expand Down
3 changes: 0 additions & 3 deletions linkerd.io/themes/buoyant/layouts/robots.txt

This file was deleted.

2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ publish = "public"
command = "make production-build"

[build.environment]
HUGO_VERSION = "0.119.0"
HUGO_VERSION = "0.126.1"

[context.deploy-preview]
command = "make preview-build"
Expand Down

0 comments on commit 9b214af

Please sign in to comment.