mirror of
https://github.com/darlinghq/blog.git
synced 2024-11-23 04:29:45 +00:00
Fix repeated blog title on home page
This commit is contained in:
parent
4a25c0fc9b
commit
f5284c4f5f
54
src/theme/BlogListPage/index.js
Normal file
54
src/theme/BlogListPage/index.js
Normal file
@ -0,0 +1,54 @@
|
||||
// the only code that has been modified in this component is BlogListPageMetadata.
|
||||
// the modification is just to comment out the title so that the site title isn't duplicated.
|
||||
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import {
|
||||
PageMetadata,
|
||||
HtmlClassNameProvider,
|
||||
ThemeClassNames,
|
||||
} from '@docusaurus/theme-common';
|
||||
import BlogLayout from '@theme/BlogLayout';
|
||||
import BlogListPaginator from '@theme/BlogListPaginator';
|
||||
import SearchMetadata from '@theme/SearchMetadata';
|
||||
import BlogPostItems from '@theme/BlogPostItems';
|
||||
|
||||
function BlogListPageMetadata(props) {
|
||||
const {metadata} = props;
|
||||
const {
|
||||
siteConfig: {title: siteTitle},
|
||||
} = useDocusaurusContext();
|
||||
const {blogDescription, blogTitle, permalink} = metadata;
|
||||
const isBlogOnlyMode = permalink === '/';
|
||||
const title = isBlogOnlyMode ? siteTitle : blogTitle;
|
||||
return (
|
||||
<>
|
||||
<PageMetadata /*title={title}*/ description={blogDescription} />
|
||||
<SearchMetadata tag="blog_posts_list" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function BlogListPageContent(props) {
|
||||
const {metadata, items, sidebar} = props;
|
||||
return (
|
||||
<BlogLayout sidebar={sidebar}>
|
||||
<BlogPostItems items={items} />
|
||||
<BlogListPaginator metadata={metadata} />
|
||||
</BlogLayout>
|
||||
);
|
||||
}
|
||||
|
||||
export default function BlogListPage(props) {
|
||||
return (
|
||||
<HtmlClassNameProvider
|
||||
className={clsx(
|
||||
ThemeClassNames.wrapper.blogPages,
|
||||
ThemeClassNames.page.blogListPage,
|
||||
)}>
|
||||
<BlogListPageMetadata {...props} />
|
||||
<BlogListPageContent {...props} />
|
||||
</HtmlClassNameProvider>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user