style: improve code readability and structure
This commit is contained in:
parent
da587d3eef
commit
9e27c0bef3
@ -1,9 +1,27 @@
|
||||
import type { PageContext } from "vike/types";
|
||||
|
||||
import { useConfig } from "vike-solid/useConfig";
|
||||
import buildTitle from "./buildTitle";
|
||||
|
||||
export type Data = Awaited<ReturnType<typeof data>>;
|
||||
|
||||
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 {
|
||||
tableOfContents: pageContext.exports.tableOfContents,
|
||||
tableOfContents,
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import config from "./+config";
|
||||
|
||||
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