docs: Implement FAQ page, default values in Cue + fix sidebar and titles

Move faq pages from guide to specific FAQ page, shown as per tailscale format.
Custom in-house logic implemented because Docusaurus doesn't manage it

Signed-off-by: guillaume <guillaume.derouville@gmail.com>
This commit is contained in:
guillaume 2022-04-12 18:41:07 +02:00
parent 15ccee2eaa
commit 204d067bcc
6 changed files with 54 additions and 8 deletions

View File

@ -1,9 +1,9 @@
---
slug: /1227/empty-buildkit-cache
slug: /1229/empty-buildkit-cache
displayed_sidebar: europa
---
# How to empty BuildKit's cache ?
# Empty BuildKit's cache
There are two ways of emptying the BuildKit cache:

View File

@ -1,9 +1,9 @@
---
slug: /1228/better-logs
slug: /1230/better-logs
displayed_sidebar: europa
---
# How can I have better logs ?
# Log formats
Dagger exposes 2 logging format options:

View File

@ -1,9 +1,9 @@
---
slug: /1229/always-execute
slug: /1231/always-execute
displayed_sidebar: europa
---
# How to make sure an action is always being executed ?
# Always executing an action
Dagger implemented a way to tell Buildkit not to rely on cache for a specific action.

View File

@ -1,9 +1,9 @@
---
slug: /1230/chain-actions
slug: /1232/chain-actions
displayed_sidebar: europa
---
# How can I chain actions together ?
# Chaining actions
Dependencies are materialized at runtime, when your Cue files are parsed and the corresponding DAG gets generated:

33
docs/faq/index.md Normal file
View File

@ -0,0 +1,33 @@
---
slug: /faq
displayed_sidebar: europa
---
# FAQ
```mdx-code-block
import DocCardList from '@theme/DocCardList';
import {useDocsVersion} from '@docusaurus/theme-common';
export const FaqItems = () => {
{/* access root category object from Docusaurus */}
const docsVersion = useDocsVersion();
{/* customProps object retrieved from sidebar.js */}
const faqItem = docsVersion.docsSidebars.europa.filter(item => item.label === 'FAQ');
{/* Return custom FAQ Items array */}
const customPropsItem = faqItem[0].customProps.items.map(customPropsItem => {
const result = Object.values(docsVersion.docs).filter(item => item.id === customPropsItem.docId)[0]
if(result)
return {
type: "link",
label: result.title,
description: result.description,
href: customPropsItem.href,
docId: customPropsItem.docId
}
})
return <DocCardList items={customPropsItem}/>
}
<FaqItems />
```

View File

@ -57,6 +57,19 @@ module.exports = {
"guides/migrate-from-dagger-0.1",
],
},
{
type: "doc",
label: "FAQ",
id: "faq/index",
customProps: {
"items": [
{ docId: "faq/empty-buildkit-cache", href: "1229/empty-buildkit-cache" },
{ docId: "faq/better-logs", href: "1230/better-logs" },
{ docId: "faq/always-execute", href: "1231/always-execute" },
{ docId: "faq/chain-actions", href: "1232/chain-actions" },
]
}
},
{
type: "category",
label: "References",