Interface.Config.md

Jan 1, 1970 reference

Defined in: packages/astro-friday/src/config.ts:262

NOTE: When passing functions as configuration values, they must be context-independent. This means all variables used within the function scope must be either:

Functions cannot access variables from the outer scope where they are defined, as they will be serialized and executed in a different context.

✅ Good example:

ts
og: (entry) => {
  const title = entry.data.title || 'Default Title'
  return [title, { width: 1200, height: 630 }]
}

❌ Bad example:

ts
const defaultTitle = 'My Site'
og: (entry) => {
  const title = entry.data.title || defaultTitle // ❌ defaultTitle is not available
  return [title, { width: 1200, height: 630 }]
}

Properties

advanced?

ts
optional advanced: object;

Defined in: packages/astro-friday/src/config.ts:664

Advanced configuration options for power using.

functionCodeReplace?

ts
optional functionCodeReplace: object[];

Function code replacement configuration for advanced using.

When passing functions as configuration values, you might want to replace certain code snippets.

Like we can solve the __vite_ssr_dynamic_import__ is not defined issue by replacing __vite_ssr_dynamic_import__("node:fs") with import("node:fs") when building.

Example
ts
advanced: {
  functionCodeReplace: [
    {
      api: 'replaceAll',
      parameters: ['__vite_ssr_dynamic_import__("node:', 'import("node:'],
    },
  ],
}

appearance?

ts
optional appearance: Appearance | "dynamic" | "plain";

Defined in: packages/astro-friday/src/config.ts:560

The appearance (theme) toggle behavior

Default

ts
'dynamic'

art?

ts
optional art: Partial<Record<"dots" | "plum", Partial<ArtConfig>>>;

Defined in: packages/astro-friday/src/config.ts:550

Page background art configuration, there are two styles available: dots and plum.

Forked from antfu.me


author?

ts
optional author: object;

Defined in: packages/astro-friday/src/config.ts:282

The author information, used in the footer and SEO metadata.

avatar?

ts
optional avatar: string;

The author’s avatar image URL.

NOTE currently not used

email?

ts
optional email: string;

The author’s email address.

NOTE currently not used

name?

ts
optional name: string;

The author’s name.

url?

ts
optional url: string;

The author’s website URL.

NOTE currently not used


collections?

ts
optional collections: Record<string, {
  glob: GlobOptions & object;
  label?: string;
}>;

Defined in: packages/astro-friday/src/config.ts:495

Define content collections

currently just glob loader supported, collections[key].glob


components?

ts
optional components: object;

Defined in: packages/astro-friday/src/config.ts:582

Default components mapping, can be overridden by user config

ts
optional NavbarBrand: string;

The component used for the brand/logo area in the navbar.

Example

ts
components: {
  NavbarBrand: 'src/components/YourBrand.astro',
}

ts
optional copyright: object;

Defined in: packages/astro-friday/src/config.ts:309

The copyright information, used in the footer.

copyrightYears?

ts
optional copyrightYears: string;

The copyright years, e.g. 2022 or 2020-2024.

Default
ts
current year

license?

ts
optional license: object;

The license information

license.type
ts
type: string;

The license type

Default
ts
'CC BY-NC-SA 4.0'
license.url
ts
url: string;

The license URL.

Default
ts
'https://creativecommons.org/licenses/by-nc-sa/4.0/'

description?

ts
optional description: string;

Defined in: packages/astro-friday/src/config.ts:270

The site description, used in SEO metadata.


imports?

ts
optional imports: object;

Defined in: packages/astro-friday/src/config.ts:566

Custom the path of function imports

@vercel/og?

ts
optional @vercel/og: string;
Default
ts
'@vercel/og'

See

https://byronogis.github.io/astro-friday/post/custom-og-middleware-handler


integrations?

ts
optional integrations: object;

Defined in: packages/astro-friday/src/config.ts:610

Integrations configuration, you can configure or disable built-in integrations here.

mdx?

ts
optional mdx: false | Partial<MdxOptions>;

MDX integration using @astrojs/mdx.

See

https://docs.astro.build/en/guides/integrations-guide/mdx/

nprogress?

ts
optional nprogress: false | Config;

Nprogress using in astro while the astro view transition is enabled.

See

https://github.com/byronogis/astro-nprogress

robotsTxt?

ts
optional robotsTxt: false | RobotsTxtOptions;

Custom robots.txt entries, will be appended to the generated robots.txt file.

Default
ts
- User-agent: * Allow: /
- Remote: https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.txt
- Sitemap: <your-site-url>/sitemap-index.xml

rss?

ts
optional rss: Partial<RSSOptions>;

seo?

ts
optional seo: any;

SEO configuration for astro-seo integration

See

Priority: default build-in < config < specific page build-in

default build-in:

sitemap?

ts
optional sitemap: false | SitemapOptions;

Sitemap generation using @astrojs/sitemap integration.

See

https://docs.astro.build/en/guides/integrations-guide/sitemap/


ts
optional logo: object;

Defined in: packages/astro-friday/src/config.ts:537

Logo configuration, used in the browser tab and top left corner of the navbar.

NOTE: if you set a custom display in navbar, you might also want to override the NavbarBrand component in components config

url?

ts
optional url: string;

override the default logo image path

Example
ts
'/favicon.svg'

ts
optional navigations: 
  | Partial<Record<"post" | "series" | "tag" | "theme-toggle" | "project", Partial<NavItem>>>
  | {
[key: string]: NavItem;
};

Defined in: packages/astro-friday/src/config.ts:521

Navigation items, used in the navbar.

You can override the built-in navs: post, tag, series, theme-toggle, project, also can define your own navigation items.

Example

ts
navigations: {
  // override built-in post nav
  post: { label: 'Blog' },
  // define your own nav
  github: { label: 'Github', icon: 'i-lucide:github', external: true, link: 'https://github.com/your-repo' }
}

pages?

ts
optional pages: Partial<Record<"404" | "home" | "rss_xml", false | InjectedRoute>>;

Defined in: packages/astro-friday/src/config.ts:531

Custom pages configuration, you can disable built-in pages by setting the value to false or override the default route by providing your own pattern and entrypoint.

Default home page is the post list page of all collections, you can also set it to a custom page.

See

https://byronogis.github.io/astro-friday/post/custom-homepage


post?

ts
optional post: object;

Defined in: packages/astro-friday/src/config.ts:337

Post related configuration

date?

ts
optional date: object;

Control the date display infos in post list and post page.

date.formats?
ts
optional formats: object;

The date format string, using dayjs format.

date.formats.long?
ts
optional long: string;

The long date format, used in post page.

Default
ts
'MMM D, YYYY'
date.formats.short?
ts
optional short: string;

The short date format, used in post list.

Default
ts
'MMM D'
date.key?
ts
optional key: "created" | "modified";

Which frontmatter field to use as the date source.

Default
ts
'created'

export?

ts
optional export: object;

Post export options

export.md?
ts
optional md: 
  | false
  | {
  rehypeParse?: Options;
  rehypeRemark?: Options;
  remarkGfm?: Options;
  remarkStringify?: Options;
};

Markdown export options, you can customize the markdown export behavior here.

Set to false to disable markdown export.

We using unified with rehype and remark plugins to convert HTML back to Markdown. You can pass options to the underlying plugins here.

Type Declaration

false

ts
{
  rehypeParse?: Options;
  rehypeRemark?: Options;
  remarkGfm?: Options;
  remarkStringify?: Options;
}

frontmatterKeys?

ts
optional frontmatterKeys: Partial<Record<FrontmatterKeysInternal, string>>;

frontmatter keys mapping to Schema fields

Like if you want to use date instead of created in frontmatter, you can set { created = 'date' } here.

The defaults is same as the field names.

plaintext

#### lang?

```ts
optional lang: object;

Post can be written in multiple languages, and to switch between these languages in the post page.

lang.collapse?
ts
optional collapse: boolean;

If set to true, just display a default language version post in post list.

lang.collapseFallbackLangCodes?
ts
optional collapseFallbackLangCodes: string[];

If collapse is true, and the post has no version for the default language, you can specify fallback language codes here to find a suitable version.

lang.default?
ts
optional default: string;

The default language code for posts without a specified language.

Default
ts
'en'
lang.langs?
ts
optional langs: object;

You can also define more information for each language here.

Index Signature
ts
[key: string]: object

og()?

ts
optional og: (entry, config) => [ReactElement, ImageOptions & ResponseInit];

Open Graph (OG) metadata for social media sharing

NOTE: You can access the frontmatter from entry.data, e.g. entry.data.title

Parameters
entry

CollectionEntry

config

ResolvedConfig

Returns

[ReactElement, ImageOptions & ResponseInit]

pathStyle?

ts
optional pathStyle: "id" | "collection/id";

Path style for post routes

Maybe you want a premalike like /post/my-first-post instead of /post/blog/my-first-post

See

https://byronogis.github.io/astro-friday/post/making-permalinks-to-posts

Default
ts
'collection/id'

sort?

ts
optional sort: "created-desc" | "created-asc" | "modified-desc" | "modified-asc";

Sort order for the posts.

By default, posts are sorted by created date in descending order (newest first).

Default
ts
'created-desc'

toc?

ts
optional toc: Partial<
  | {
  enable?: boolean;
  range?: [number, number];
}
| undefined>;

Table of contents (TOC) generation for all content

NOTE: this is just a default config for all content, can be overridden in specific content frontmatter

Default
ts
{ enable: true, range: [2, 4] }

postcss?

ts
optional postcss: object;

Defined in: packages/astro-friday/src/config.ts:603

Built-in PostCSS plugins configuration options

postcssGlobalData?

ts
optional postcssGlobalData: pluginOptions;

postcssPresetEnv?

ts
optional postcssPresetEnv: pluginOptions;

prefix?

ts
optional prefix: string;

Defined in: packages/astro-friday/src/config.ts:278

The prefix for all built-in routes, e.g. /post, /tag, /series.

Default

’/’ mean no prefix, e.g. /post

Example

ts
'/content' will make routes like `/content/post`

processors?

ts
optional processors: object;

Defined in: packages/astro-friday/src/config.ts:487

Processors to process each content entry

processorId?

ts
optional processorId: ProcessorIdOptions;

Ensure the entry has an ID in the frontmatter.

processorLangs?

ts
optional processorLangs: ProcessorLangsOptions;

Automatically set the langs codes for the entry.

ts
optional processorPermalink: ProcessorPermalinkOptions;

Generate a permalink for the entry.

processorTitle?

ts
optional processorTitle: ProcessorTitleOptions;

A processor to set the title of an entry based on its file name if not already set.

processorUpdateModifiedTime?

ts
optional processorUpdateModifiedTime: ProcessorUpdateModifiedTimeOptions;

With this processor, you can automatically update the modified frontmatter key of your markdown files to reflect their last modified time.


projects?

ts
optional projects: ProjectItem[];

Defined in: packages/astro-friday/src/config.ts:660

Project showcase items, used in the /project page.

A page route for /project will be automatically created if there are more than 0 projects defined.

Default

ts
[]

title?

ts
optional title: string;

Defined in: packages/astro-friday/src/config.ts:266

The site title, used in the navbar and SEO metadata.


viewTransition?

ts
optional viewTransition: object;

Defined in: packages/astro-friday/src/config.ts:593

View transition functionality configuration

enable?

ts
optional enable: boolean;

Enable or disable view transitions for page navigation.

Default
ts
true

See

https://docs.astro.build/en/guides/view-transitions/