rework/lightweight #12
@ -1,9 +1,27 @@
|
|||||||
import type { PageContext } from "vike/types";
|
import type { PageContext } from "vike/types";
|
||||||
|
|
||||||
|
import { useConfig } from "vike-solid/useConfig";
|
||||||
|
import buildTitle from "./buildTitle";
|
||||||
|
|
||||||
export type Data = Awaited<ReturnType<typeof data>>;
|
export type Data = Awaited<ReturnType<typeof data>>;
|
||||||
|
|
||||||
export async function data(pageContext: PageContext) {
|
export async function data(pageContext: PageContext) {
|
||||||
|
const config = useConfig();
|
||||||
|
|
||||||
|
const {
|
||||||
|
exports: { tableOfContents, frontmatter },
|
||||||
|
urlParsed,
|
||||||
|
} = pageContext;
|
||||||
|
const isRoot = urlParsed.pathname === "/";
|
||||||
|
|
||||||
|
console.log({ isRoot, urlParsed });
|
||||||
|
|
||||||
|
config({
|
||||||
|
title: buildTitle(isRoot ? undefined : frontmatter?.title),
|
||||||
|
description: frontmatter?.description,
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tableOfContents: pageContext.exports.tableOfContents,
|
tableOfContents,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import config from "./+config";
|
import config from "./+config";
|
||||||
|
|
||||||
export function title() {
|
export function title() {
|
||||||
return `Synthèses et ressources pour développeurs - ${config.title}`;
|
return `Synthèses et ressources pour développeurs | ${config.title}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user