mirror of https://github.com/buildpacks/docs.git
Switch to pagefind for search (#870)
We have more control over search indices if we use a local search library Signed-off-by: adelaney21 <adelaney21@bloomberg.net>
This commit is contained in:
parent
76f355fff1
commit
f8ea7651c2
|
|
@ -21,12 +21,17 @@ jobs:
|
|||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '1.x'
|
||||
# Node is used to generate the pagefind index
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 'latest'
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get install make curl jq
|
||||
- name: Install pack
|
||||
uses: buildpacks/github-actions/setup-pack@v5.9.5
|
||||
with:
|
||||
pack-version: '0.36.0'
|
||||
pack-version: '0.38.2'
|
||||
- name: Test
|
||||
run: make test
|
||||
env:
|
||||
|
|
|
|||
12
Makefile
12
Makefile
|
|
@ -30,17 +30,9 @@ TOOLS_BIN:=tools/bin
|
|||
$(TOOLS_BIN):
|
||||
mkdir $(TOOLS_BIN)
|
||||
|
||||
# adapted from https://stackoverflow.com/a/12099167/552902
|
||||
HUGO_OS:=Linux
|
||||
HUGO_ARCH:=32bit
|
||||
HUGO_ARCH:=64bit
|
||||
HUGO_EXT:=tar.gz
|
||||
ifeq ($(OS),Windows_NT)
|
||||
HUGO_OS:=Windows
|
||||
HUGO_EXT:=zip
|
||||
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
|
||||
HUGO_ARCH:=64bit
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname -s),Darwin)
|
||||
HUGO_OS:=darwin
|
||||
|
|
@ -135,6 +127,8 @@ build: export PACK_VERSION:=$(PACK_VERSION)
|
|||
build: $(HUGO_BIN) pack-version pack-docs-update
|
||||
@echo "> Building..."
|
||||
$(HUGO_BIN)
|
||||
# Github Workflows ensures `node` is installed.
|
||||
npx pagefind --site ./public
|
||||
|
||||
.PHONY: test
|
||||
test: install-pack-cli check-pack-cli-version install-ugo
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
.algolia-autocomplete {
|
||||
display: block !important;
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@
|
|||
@import 'code';
|
||||
@import 'syntax';
|
||||
|
||||
@import 'components/algolia';
|
||||
@import 'components/header';
|
||||
@import 'components/hero';
|
||||
@import 'components/grid';
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
{{ $style := resources.Get "scss/site.scss" | toCSS }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}" media="screen">
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
|
||||
<link rel="stylesheet" href="/pagefind/pagefind-ui.css">
|
||||
<script src="/pagefind/pagefind-ui.js"></script>
|
||||
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-CJLSR4FQXL"></script>
|
||||
<link rel="stylesheet"
|
||||
|
|
@ -35,31 +35,6 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('h1[id], h2[id], h3[id], h4[id], h5[id]').not(':has(a)').each(function () {
|
||||
this.innerHTML =
|
||||
`<a href="#${this.id}" class="h-anchor">
|
||||
${this.innerHTML} <i class="fas fa-link icon" aria-label="Anchor"></i>
|
||||
</a>`;
|
||||
});
|
||||
|
||||
if ($('input#search').length > 0) {
|
||||
docsearch({
|
||||
apiKey: '5c00a51f166dab99e1cc6e0a9976e9f9',
|
||||
indexName: 'buildpacks',
|
||||
inputSelector: 'input#search',
|
||||
debug: false
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'G-CJLSR4FQXL');
|
||||
</script>
|
||||
|
||||
<title>{{ .Title | plainify }} · {{ .Site.Title }}</title>
|
||||
</head>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,16 @@
|
|||
{{- $currentNode := . -}}
|
||||
|
||||
<nav class='sidebar'>
|
||||
<form class="pt-1 pb-3 pl-2 pr-3 border-bottom">
|
||||
<input id="search" class="form-control" type="search" placeholder="Search..." aria-label="Search">
|
||||
</form>
|
||||
<div id="search"></div>
|
||||
<script>
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
new PagefindUI({
|
||||
element: "#search",
|
||||
showSubResults: true,
|
||||
bundlePath: "/pagefind/"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ with .Site.GetPage "/docs" }}
|
||||
{{- $home := . -}}
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ require (
|
|||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||
github.com/cli/safeexec v1.0.1 // indirect
|
||||
github.com/clipperhouse/stringish v0.1.1 // indirect
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.1 // indirect
|
||||
|
|
@ -131,7 +130,6 @@ require (
|
|||
github.com/gdamore/encoding v1.0.1 // indirect
|
||||
github.com/gdamore/tcell/v2 v2.9.0 // indirect
|
||||
github.com/getkin/kin-openapi v0.133.0 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.6.2 // indirect
|
||||
github.com/go-git/go-git/v5 v5.16.3 // indirect
|
||||
|
|
@ -139,7 +137,6 @@ require (
|
|||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.22.1 // indirect
|
||||
github.com/go-openapi/swag v0.25.1 // indirect
|
||||
github.com/go-openapi/swag/jsonname v0.25.1 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||
github.com/gobuffalo/flect v1.0.3 // indirect
|
||||
|
|
@ -171,7 +168,6 @@ require (
|
|||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/heroku/color v0.0.6 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/invopop/yaml v0.3.1 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jdkato/prose v1.2.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
|
|
@ -255,8 +251,6 @@ require (
|
|||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
github.com/yuin/goldmark v1.7.13 // indirect
|
||||
github.com/yuin/goldmark-emoji v1.0.6 // indirect
|
||||
github.com/zeebo/errs v1.4.0 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.38.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
|
||||
|
|
@ -270,7 +264,6 @@ require (
|
|||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
gocloud.dev v0.43.0 // indirect
|
||||
golang.org/x/crypto v0.43.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
|
||||
golang.org/x/image v0.32.0 // indirect
|
||||
golang.org/x/mod v0.29.0 // indirect
|
||||
golang.org/x/net v0.46.0 // indirect
|
||||
|
|
@ -289,7 +282,6 @@ require (
|
|||
google.golang.org/grpc v1.76.0 // indirect
|
||||
google.golang.org/protobuf v1.36.10 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
howett.net/plist v1.0.1 // indirect
|
||||
rsc.io/qr v0.2.0 // indirect
|
||||
|
|
|
|||
636
tools/go.sum
636
tools/go.sum
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue