fix(blog): authors count incorrectly rendered (#10431)

Co-authored-by: sebastien <lorber.sebastien@gmail.com>
This commit is contained in:
ozaki 2024-08-23 14:07:49 +02:00 committed by GitHub
parent afd2374ca6
commit aa65f39d8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 60 additions and 4 deletions

View file

@ -83,7 +83,7 @@ export default function BlogAuthor({
<AuthorName name={name} as={as} />
</MaybeLink>
)}
{count && <AuthorBlogPostCount count={count} />}
{count !== undefined && <AuthorBlogPostCount count={count} />}
</div>
{!!title && <AuthorTitle title={title} />}

View file

@ -15,6 +15,7 @@ import {
import {
useBlogAuthorPageTitle,
BlogAuthorsListViewAllLabel,
BlogAuthorNoPostsLabel,
} from '@docusaurus/theme-common/internal';
import Link from '@docusaurus/Link';
import {useBlogMetadata} from '@docusaurus/plugin-content-blog/client';
@ -52,9 +53,17 @@ function Content({author, items, sidebar, listMetadata}: Props): JSX.Element {
{author.description && <p>{author.description}</p>}
<ViewAllAuthorsLink />
</header>
<hr />
<BlogPostItems items={items} />
<BlogListPaginator metadata={listMetadata} />
{items.length === 0 ? (
<p>
<BlogAuthorNoPostsLabel />
</p>
) : (
<>
<hr />
<BlogPostItems items={items} />
<BlogListPaginator metadata={listMetadata} />
</>
)}
</BlogLayout>
);
}

View file

@ -96,4 +96,5 @@ export {
useBlogAuthorPageTitle,
translateBlogAuthorsListPageTitle,
BlogAuthorsListViewAllLabel,
BlogAuthorNoPostsLabel,
} from './translations/blogTranslations';

View file

@ -77,3 +77,13 @@ export function BlogAuthorsListViewAllLabel(): ReactNode {
</Translate>
);
}
export function BlogAuthorNoPostsLabel(): ReactNode {
return (
<Translate
id="theme.blog.author.noPosts"
description="The text for authors with 0 blog post">
This author has not written any posts yet.
</Translate>
);
}

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "أرشيف",
"theme.blog.archive.title": "أرشيف",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -45,6 +45,8 @@
"theme.blog.archive.description___DESCRIPTION": "The page & hero description of the blog archive page",
"theme.blog.archive.title": "Archive",
"theme.blog.archive.title___DESCRIPTION": "The page & hero title of the blog archive page",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.noPosts___DESCRIPTION": "The text for authors with 0 blog post",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.author.pageTitle___DESCRIPTION": "The title of the page for a blog author",
"theme.blog.authorsList.pageTitle": "Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "Внимание",
"theme.blog.archive.description": "Архив",
"theme.blog.archive.title": "Архив",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warnung",
"theme.blog.archive.description": "Archiv",
"theme.blog.archive.title": "Archiv",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "aviso",
"theme.blog.archive.description": "Archivo",
"theme.blog.archive.title": "Archivo",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "hoiatus",
"theme.blog.archive.description": "Arhiiv",
"theme.blog.archive.title": "Arhiiv",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "هشدار",
"theme.blog.archive.description": "آرشیو",
"theme.blog.archive.title": "آرشیو",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "attention",
"theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "vigyázat",
"theme.blog.archive.description": "Archívum",
"theme.blog.archive.title": "Archívum",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "peringatan",
"theme.blog.archive.description": "Arsip",
"theme.blog.archive.title": "Arsip",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "aðvörun",
"theme.blog.archive.description": "Skjalasafn",
"theme.blog.archive.title": "Skjalasafn",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archivio",
"theme.blog.archive.title": "Archivio",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "警告",
"theme.blog.archive.description": "アーカイブ",
"theme.blog.archive.title": "アーカイブ",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "경고",
"theme.blog.archive.description": "게시물 목록",
"theme.blog.archive.title": "게시물 목록",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arkiv",
"theme.blog.archive.title": "Arkiv",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archief",
"theme.blog.archive.title": "Archief",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archiwum",
"theme.blog.archive.title": "Archiwum",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "atenção",
"theme.blog.archive.description": "Arquivo",
"theme.blog.archive.title": "Arquivo",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Archive",
"theme.blog.archive.title": "Archive",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Архив",
"theme.blog.archive.title": "Архив",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arhiv",
"theme.blog.archive.title": "Arhiv",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Архива",
"theme.blog.archive.title": "Архива",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arkiv",
"theme.blog.archive.title": "Arkiv",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "duýduryş",
"theme.blog.archive.description": "Arhiw",
"theme.blog.archive.title": "Arhiw",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Arşiv",
"theme.blog.archive.title": "Arşiv",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Архів",
"theme.blog.archive.title": "Архів",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "warning",
"theme.blog.archive.description": "Lưu trữ",
"theme.blog.archive.title": "Lưu trữ",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "注意",
"theme.blog.archive.description": "历史博文",
"theme.blog.archive.title": "历史博文",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",

View file

@ -22,6 +22,7 @@
"theme.admonition.warning": "注意",
"theme.blog.archive.description": "歷史文章",
"theme.blog.archive.title": "歷史文章",
"theme.blog.author.noPosts": "This author has not written any posts yet.",
"theme.blog.author.pageTitle": "{authorName} - {nPosts}",
"theme.blog.authorsList.pageTitle": "Authors",
"theme.blog.authorsList.viewAll": "View All Authors",