Skip to content

Commit

Permalink
fix(blog): authors count incorrectly rendered (#10431)
Browse files Browse the repository at this point in the history
Co-authored-by: sebastien <[email protected]>
  • Loading branch information
OzakIOne and slorber committed Aug 23, 2024
1 parent afd2374 commit aa65f39
Show file tree
Hide file tree
Showing 39 changed files with 60 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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} />}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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>
);
}
Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus-theme-common/src/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ export {
useBlogAuthorPageTitle,
translateBlogAuthorsListPageTitle,
BlogAuthorsListViewAllLabel,
BlogAuthorNoPostsLabel,
} from './translations/blogTranslations';
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit aa65f39

Please sign in to comment.