Skip to content

Commit

Permalink
Merge branch 'main' of github.com:holochain/docs-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
pdaoust committed Feb 29, 2024
2 parents 679b1e9 + 9ad3945 commit 87c2ff7
Show file tree
Hide file tree
Showing 9 changed files with 399 additions and 96 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ Additionally the following `markdown-it` plugins have been added:
Please note: The closing `:::` is required. Also if you need to nest containers then the outer container gets an additional `:`.
Each container type needs to be configured in `markdown-it-config.js` for examples and to add more. This one provides a lot of flexibility.

## Site search and indexing
The site uses the [Pagefind](https://pagefind.app/) library to index the contents of the site and to find search results upon request.
The documentation is quite good. One thing to note; pages are indexed based on the inclusion of the `data-pagefind-body`
attribute on a page. It is included on all of the main pages (all but the Design System). If you need to remove some or all of a page
from indexing you can use the `data-pagefind-ignore` attribute. See (https://pagefind.app/docs/indexing/) for details.

## Setup for Dev
- `npm install`
Expand Down
183 changes: 116 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"doc": "docs"
},
"scripts": {
"build:search-index": "npx pagefind --source _site --glob \"**/*.html\"",
"build:search-index": "npx pagefind --site _site --glob \"**/*.html\"",
"build:web": "ELEVENTY_ENV=production npx @11ty/eleventy",
"serve:web": "ELEVENTY_ENV=development npx @11ty/eleventy --serve --incremental",
"serve:web-prod": "ELEVENTY_ENV=production BROWERSYNC=off npx @11ty/eleventy --serve",
Expand Down Expand Up @@ -72,6 +72,6 @@
"uglify-js": "^3.17.4"
},
"dependencies": {
"pagefind": "^0.12.0"
"pagefind": "1.0.4"
}
}
3 changes: 2 additions & 1 deletion src/client-side/page-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const PagefindSearchKey = "pagefind-search";
function setupPagefindUI() {
const pagefindUIInstance = new PagefindUI({
element: "#search",
showImages: false
showImages: false,
showSubResults: true
});

const searchInput = window.document.querySelector<HTMLInputElement>("#search .pagefind-ui__search-input")!;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/_includes/base-layout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
{% include "parts/head.njk" %}

<body class="{{ pageStyleId }} {{ layoutId }}">
<body class="{{ pageStyleId }} {{ layoutId }}" data-pagefind-body>
{% include "parts/header.njk" %}
{% renderlayoutblock "abovePageWrap" %}{% endrenderlayoutblock %}

Expand Down
15 changes: 9 additions & 6 deletions src/pages/get-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ You should see something like:

::: output-block
```text
holochain_scaffolding_cli 0.1.8
holochain_scaffolding_cli x.y.z
The list of subcommands for `hc scaffold`
USAGE:
Expand Down Expand Up @@ -535,7 +535,9 @@ Updating crates.io index
Fetch [===> ] ...
```
:::
(then after download is done...)

(then after download is done...)

::: output-block
```text
Downloaded 244 crates (46.7 MB) in 4.27s (largest was `windows` at 11.9 MB)
Expand Down Expand Up @@ -687,7 +689,7 @@ After adding the `title` and `content` fields, press <kbd>N</kbd> when asked if
::: output-block
```text
Which CRUD functions should be scaffolded (SPACE to select/unselect, ENTER to continue)?
Update
Update
✔ Delete
```
:::
Expand Down Expand Up @@ -1082,13 +1084,14 @@ Your `App.svelte` file will have three sections:
import { clientContext } from './contexts';
let client: AppAgentClient | undefined;
let loading = true;
$: client, loading;
onMount(async () => {
// We pass '' as url because it will dynamically be replaced in launcher environments
client = await AppAgentWebsocket.connect('', 'forum');
// We pass an unused string as the url because it will dynamically be replaced in launcher environments
client = await AppAgentWebsocket.connect(new URL('https://UNUSED'), 'forum');
loading = false;
});
Expand Down
Loading

0 comments on commit 87c2ff7

Please sign in to comment.