Skip to content

Global Context

Global context contains configuration applied to the particular pdf/web page where it’s defined. Each page requires exactly one global context defined at the top of the page (after imports).

In component approach you define the context using functions.

await initializeWebContext(Astro, {
/* Configuration */
});
await initializePdfContext(Astro, {
/* Configuration */
});

In template approach pass context configuration as a context property.

const props: ComponentProps<typeof MainTemplate> = {
context: {
/* Configuration */
},
};

Web context

Context used for web pages (pages located directly in the /src/pages directory).

locale object | string required

A date-fns locale to use for date formatting and determining the default language of the page. In component approach you import it from date-fns/locale. In template approach you pass the locale name as a string.

translations entry | string required

One of the translations stored in the src/content/translations directory. Used to translate content of come components. In component approach you access it using getEntry('translations', '[slug]'). In template approach you pass the translation slug as a string.

dateFormat string required

A format of all dates used within the page. You can check available date-fns format tokens here.

theme string required

A theme to use for the page. Available values are:

  • 'light' - use light theme.
  • 'dark' - use dark theme.
  • 'system' - use system theme.
  • 'custom' - use system theme by default, but allow user to change it.
pdf object

Configuration of the button that allows to download your PDF resume.

pdf.path boolean

Path to the PDF file in the /public directory. Files generated by Zenith are stored in the /public/generated/pdf directory.

pdf.label string

Label of the PDF download button.

pdf.filename string

Name of the downloaded PDF file.

PDF context

Context used for pdf pages (pages located directly in the /src/pages/pdf directory).

locale object | string required

A date-fns locale to use for date formatting and determining the default language of the page. In component approach you import it from date-fns/locale. In template approach you pass the locale name as a string.

translations entry | string required

One of the translations stored in the src/content/translations directory. Used to translate content of come components. In component approach you access it using getEntry('translations', '[slug]'). In template approach you pass the translation slug as a string.

dateFormat string required

A format of all dates used within the page. You can check available date-fns format tokens here.

website string

URL of path of the website where PDF will link to. For pages created with Zenith you can pass only the path (starting with /). For external websites you need to pass the full URL.