Add search widget

This commit is contained in:
Andres Almiray
2021-05-30 16:07:08 +02:00
parent 43aeca9b0f
commit 031f6045ac
14 changed files with 255 additions and 65 deletions

View File

@@ -32,3 +32,14 @@ jobs:
folder: website
branch: 'gh-pages'
commit-message: "[CI] Publish Documentation for ${{ github.sha }}"
- name: Read search configuration
id: config
run: echo ::set-output name=config::$(cat algolia-config.json)
- name: Update search index
uses: docker://algolia/documentation-scrapper
env:
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
API_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
CONFIG: ${{ steps.config.outputs.config }}

View File

@@ -31,3 +31,14 @@ jobs:
folder: website
branch: 'gh-pages'
commit-message: "[CI] Publish Documentation for ${{ github.sha }}"
- name: Read search configuration
id: config
run: echo ::set-output name=config::$(cat algolia-config.json)
- name: Update search index
uses: docker://algolia/documentation-scrapper
env:
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
API_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
CONFIG: ${{ steps.config.outputs.config }}

24
algolia-config.json Normal file
View File

@@ -0,0 +1,24 @@
{
"index_name": "jreleaser-docs",
"start_urls": [
"https://jreleaser.org/guide/latest"
],
"sitemap_urls": [
"https://jreleaser.org/sitemap.xml"
],
"stop_urls": [],
"selectors": {
"lvl0": {
"selector": "//nav[@class='crumbs']//li[@class='crumb'][last()-1]",
"type": "xpath",
"global": true,
"default_value": "Home"
},
"lvl1": ".doc h1",
"lvl2": ".doc h2",
"lvl3": ".doc h3",
"lvl4": ".doc h4",
"text": ".doc p, .doc td.content, .doc th.tableblock"
}
}

View File

@@ -30,6 +30,8 @@ project:
java:
groupId: org.jreleaser
version: 8
extraProperties:
inceptionYear: 2020
# The repository is hosted at https://github.com/jreleaser/jreleaser
# which means the default username would be `jreleaser` however a
@@ -102,7 +104,13 @@ assemble:
- java.naming
- java.rmi
- java.security.jgss
- java.security.sasl
- java.sql
- jdk.crypto.ec
- jdk.crypto.cryptoki
- jdk.security.auth
- jdk.security.jgss
- org.openjsse
targetJdks:
- path: 'apps/jreleaser/build/jdks/zulu11.48.21-ca-jdk11.0.11-macosx_x64/zulu-11.jdk/Contents/Home'
platform: osx

View File

@@ -1,5 +1,22 @@
<!--script src="{{{uiRootPath}}}/js/fontawesome.js"></script>
<script src="{{{uiRootPath}}}/js/all.js"></script-->
<script src="{{{uiRootPath}}}/js/vendor/docsearch.min.js"></script>
<!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js -->
<script>
var search = docsearch({
appId: 'K5Y4OVVWUX',
apiKey: 'ea6938b1fbb14f00357f946168443c2d',
indexName: 'jreleaser-docs',
inputSelector: '#search-input',
autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
algoliaOptions: { hitsPerPage: 10 }
}).autocomplete
search.on('autocomplete:closed', function () { search.autocomplete.setVal() })
</script>
<script>
window.addEventListener('load', function focusSearchInput () {
window.removeEventListener('load', focusSearchInput)
document.querySelector('#search-input').focus()
})
</script>
<script src="{{{uiRootPath}}}/js/site.js"></script>
<script async src="{{{uiRootPath}}}/js/vendor/highlight.js"></script>

Binary file not shown.

View File

@@ -0,0 +1,130 @@
.tabs ul {
display: flex;
flex-wrap: wrap;
list-style: none;
margin: 0 -0.25rem 0 0;
padding: 0;
}
.tabs li {
align-items: center;
border: 1px solid black;
border-bottom: 0;
cursor: pointer;
display: flex;
font-weight: bold;
height: 2.5rem;
line-height: 1;
margin-right: 0.25rem;
padding: 0 1.5rem;
position: relative;
}
.tabs.ulist li {
margin-bottom: 0;
}
.tabs li + li {
margin-top: 0;
}
.tabset.is-loading .tabs li:not(:first-child),
.tabset:not(.is-loading) .tabs li:not(.is-active) {
background-color: black;
color: white;
}
.tabset.is-loading .tabs li:first-child::after,
.tabs li.is-active::after {
background-color: white;
content: "";
display: block;
height: 3px; /* Chrome doesn't always paint the line accurately, so add a little extra */
position: absolute;
bottom: -1.5px;
left: 0;
right: 0;
}
.tabset > .content {
border: 1px solid gray;
padding: 1.25rem;
}
.tabset.is-loading .tab-pane:not(:first-child),
.tabset:not(.is-loading) .tab-pane:not(.is-active) {
display: none;
}
.tab-pane > :first-child {
margin-top: 0;
}
.navbar-brand .navbar-item + .navbar-item {
-ms-flex-positive: 1;
-webkit-box-flex: 1;
flex-grow: 1;
-ms-flex-pack: end;
-webkit-box-pack: end;
justify-content: flex-end;
}
.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] {
max-height: calc(100vh - 3.25rem);
}
.algolia-autocomplete .algolia-docsearch-suggestion--title {
font-weight: 500;
}
.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column {
font-weight: normal;
}
@media screen and (max-width: 768px) {
.navbar-brand .navbar-item + .navbar-item {
padding-left: 0;
padding-right: 0;
}
.algolia-autocomplete .ds-dropdown-menu {
min-width: calc(100vw - 2.75rem) !important;
}
}
@media screen and (min-width: 1024px) {
.navbar-brand {
-ms-flex-positive: 1;
-webkit-box-flex: 1;
flex-grow: 1;
}
.navbar-menu {
-ms-flex-positive: 0;
-webkit-box-flex: 0;
flex-grow: 0;
}
}
#search-input {
color: #333;
font-family: inherit;
font-size: 0.95rem;
width: 150px;
border: 1px solid #dbdbdb;
border-radius: 0.1em;
line-height: 1.5;
padding: 0 0.25em;
}
@media screen and (min-width: 769px) {
#search-input {
width: 200px;
}
}
.doc .image.conum > img {
height: 0.9em;
width: auto;
vertical-align: -0.1em;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
ui-bundle/js/vendor/docsearch.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,21 @@
<script async src="{{{uiRootPath}}}/js/vendor/docsearch.min.js"></script>
<!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js -->
<script>
var search = docsearch({
appId: 'K5Y4OVVWUX',
apiKey: 'ea6938b1fbb14f00357f946168443c2d',
indexName: 'jreleaser-docs',
inputSelector: '#search-input',
autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
algoliaOptions: { hitsPerPage: 10 }
}).autocomplete
search.on('autocomplete:closed', function () { search.autocomplete.setVal() })
</script>
<script>
window.addEventListener('load', function focusSearchInput () {
window.removeEventListener('load', focusSearchInput)
document.querySelector('#search-input').focus()
})
</script>
<script src="{{{uiRootPath}}}/js/site.js"></script>
<script async src="{{{uiRootPath}}}/js/vendor/highlight.js"></script>

View File

@@ -1 +1,4 @@
<link rel="stylesheet" href="{{{uiRootPath}}}/css/site.css">
<link rel="stylesheet" href="{{{uiRootPath}}}/css/site-extra.css">
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/docsearch.min.css">
<!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css -->

View File

@@ -1,12 +1,37 @@
<header class="header">
<nav class="navbar">
<div class="navbar-brand">
<div class="navbar-item">
<a class="navbar-item" href="{{{or site.url (or siteRootUrl siteRootPath)}}}">{{site.title}}</a>
</div>
<div class="navbar-item hide-for-print">
<input id="search-input" type="text" placeholder="Search (by Algolia)">
</div>
<button class="navbar-burger" data-target="topbar-nav">
<span></span>
<span></span>
<span></span>
</button>
</div>
<div id="topbar-nav" class="navbar-menu">
<div class="navbar-end">
<div class="navbar-item has-dropdown is-hoverable">
<div class="navbar-link">Project</div>
<div class="navbar-dropdown">
<a class="navbar-item" href="https://github.com/jreleaser/jreleaser">Repository</a>
<a class="navbar-item" href="https://github.com/jreleaser/jreleaser/issues">Issue Tracker</a>
<hr class="navbar-divider">
<a class="navbar-item" href="https://github.com/jreleaser/jreleaser/blob/main/CONTRIBUTING.adoc">Contributing</a>
</div>
</div>
<a class="navbar-item" href="https://twitter.com/jreleaser">
<span class="icon">
<svg aria-hidden="true" data-icon="twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="#ffffff" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path>
</svg>
</span>
</a>
</div>
</div>
</nav>
</header>