Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/apisix-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @type {Array<string>} version list
*/
const versions = ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15', '3.16', '3.17', '3.18'];
const versions = ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15', '3.16', '3.17', '3.18', '3.19'];

/**
* @type {Array<string>} LTS version list
Expand Down
2 changes: 1 addition & 1 deletion next/src/layouts/Article.astro
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const jsonLd = [{
description: post.description,
...(post.dateStr ? { datePublished: post.dateStr } : {}),
image: post.image,
author: post.author ? { '@type': 'Person', name: post.author } : { '@type': 'Organization', name: 'Apache APISIX' },
author: post.authors?.length ? post.authors.map((name) => ({ '@type': 'Person', name })) : post.author ? { '@type': 'Person', name: post.author } : { '@type': 'Organization', name: 'Apache APISIX' },
publisher: { '@type': 'Organization', name: 'Apache APISIX', url: SITE },
mainEntityOfPage: `${SITE}${locale === 'zh' ? '/zh' : ''}${path}`,
}, ...jsonLdExtra];
Expand Down
14 changes: 12 additions & 2 deletions next/src/lib/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface Post {
tags: string[];
image?: string;
author?: string;
authors?: string[];
/** Stable source identity used to pair real EN/ZH blog translations. */
translationKey?: string;
mod: MdModule;
Expand Down Expand Up @@ -145,6 +146,7 @@ function blogPost(path: string, mod: MdModule, locale: Locale): Post | null {
// normalizeUrl collapses it; see the 2021-06-03 firsthand-experience post).
const slug = (fmSlug ?? name).replace(/^\/+/, '');
const urlPath = slug.includes('/') ? slug : `${y}/${mo}/${d}/${slug}`;
const authors = authorNames(mod.frontmatter);
return {
url: `${localePrefix(locale)}/blog/${urlPath}/`,
slug: urlPath,
Expand All @@ -155,8 +157,8 @@ function blogPost(path: string, mod: MdModule, locale: Locale): Post | null {
dateHuman: humanDate(new Date(`${y}-${mo}-${d}T00:00:00Z`), locale),
tags: toTags(mod.frontmatter),
image: mod.frontmatter.image,
author: mod.frontmatter.author
?? (Array.isArray(mod.frontmatter.authors) ? mod.frontmatter.authors[0]?.name : undefined),
author: authors.length ? authors.join(', ') : undefined,
authors,
translationKey: String(
mod.frontmatter.translationKey
?? mod.frontmatter.translation_key
Expand All @@ -166,6 +168,14 @@ function blogPost(path: string, mod: MdModule, locale: Locale): Post | null {
};
}

function authorNames(fm: any): string[] {
if (fm.author) return [String(fm.author)];
if (!Array.isArray(fm.authors)) return [];
return fm.authors
.map((a: any) => (typeof a === 'string' ? a : a?.name))
.filter(Boolean);
}

function flatPost(path: string, mod: MdModule, urlBase: string, locale: Locale): Post {
const slug = mod.frontmatter.slug ?? baseName(path);
const date = mod.frontmatter.date ? new Date(mod.frontmatter.date) : new Date(0);
Expand Down
Loading