docs: add category heading in docs pages (#8918)

Co-authored-by: Romain Crestey <romain.crestey@radiofrance.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
pull/8955/head
Romain l'Ourson 2 years ago committed by GitHub
parent 85d49404d3
commit 258ccf204b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -75,6 +75,7 @@ export async function get_docs_data(base = CONTENT_BASE_PATHS.DOCS) {
title: page_title, title: page_title,
slug: page_slug, slug: page_slug,
content: page_content, content: page_content,
category: category_title,
sections: get_sections(page_content), sections: get_sections(page_content),
path: `${app_base}/docs/${page_slug}`, path: `${app_base}/docs/${page_slug}`,
file: `${category_dir}/${filename}` file: `${category_dir}/${filename}`

@ -17,6 +17,7 @@ export type Category = {
export type Page = { export type Page = {
title: string; title: string;
category: string;
slug: string; slug: string;
file: string; file: string;
path: string; path: string;

@ -4,7 +4,10 @@
export let data; export let data;
$: title = $page.data.page?.title; $: pageData = $page.data.page;
$: title = pageData?.title;
$: category = pageData?.category;
</script> </script>
<div class="container"> <div class="container">
@ -13,6 +16,9 @@
</div> </div>
<div class="page content"> <div class="page content">
{#if category}
<p class="category">{category}</p>
{/if}
{#if title} {#if title}
<h1>{title}</h1> <h1>{title}</h1>
{/if} {/if}
@ -41,6 +47,14 @@
all: unset; all: unset;
} }
.category {
font: 700 var(--sk-text-s) var(--sk-font);
text-transform: uppercase;
letter-spacing: 0.12em;
margin: 0 0 0.5em;
color: var(--sk-text-3);
}
@media (min-width: 832px) { @media (min-width: 832px) {
.content { .content {
padding-left: calc(var(--sidebar-width) + var(--sk-page-padding-side)); padding-left: calc(var(--sidebar-width) + var(--sk-page-padding-side));

Loading…
Cancel
Save