mirror of
https://gitea.com/gitea/blog.git
synced 2024-06-02 02:51:25 +05:30
c3d361092e
- Updated readme - Used double quotes instead of single quotes - Increase blog content width Before ![Screen Shot 2023-07-14 at 13.45.45](/attachments/9c669c42-2efd-4ae5-bbf5-24f252c26fa0) After ![Screen Shot 2023-07-14 at 13.45.31](/attachments/6f72912c-2fd9-4a63-8839-583864faa474) - Added subscribe and community components to buttom of the blog post page. ![Screen Shot 2023-07-14 at 15.55.12](/attachments/3808fa5a-e951-487b-8ed2-dc693cfec9e2) ![Screen Shot 2023-07-14 at 15.55.30](/attachments/864ff357-a116-47ce-abf0-8278e24ede7d) Loading: ![Screen Shot 2023-07-14 at 15.57.00](/attachments/2f0ace67-d83e-4415-a778-8e7913fb6505) Post sent: ![Screen Shot 2023-07-14 at 13.48.44](/attachments/ceac4970-a914-49d5-ad42-febb3d259d89) Mobile: ![Screen Shot 2023-07-14 at 15.58.19](/attachments/7e01f575-7e4d-4d99-9888-7fb246ceb313) ![Screen Shot 2023-07-14 at 15.58.27](/attachments/879128d1-f115-41a7-8e8e-574f0b3de208) Reviewed-on: https://gitea.com/gitea/blog/pulls/272 Co-authored-by: HesterG <hestergong@gmail.com> Co-committed-by: HesterG <hestergong@gmail.com>
67 lines
2.2 KiB
JavaScript
67 lines
2.2 KiB
JavaScript
// Ejected unsafe, need to check if this changes and maintain this component
|
|
// https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx
|
|
import React from "react";
|
|
import clsx from "clsx";
|
|
import {HtmlClassNameProvider, ThemeClassNames} from "@docusaurus/theme-common";
|
|
import {BlogPostProvider, useBlogPost} from "@docusaurus/theme-common/internal";
|
|
import BlogLayout from "@theme/BlogLayout";
|
|
import BlogPostItem from "@theme/BlogPostItem";
|
|
import BlogPostPaginator from "@theme/BlogPostPaginator";
|
|
import BlogPostPageMetadata from "@theme/BlogPostPage/Metadata";
|
|
import TOC from "@theme/TOC";
|
|
import styles from "./styles.module.css";
|
|
|
|
// customized:
|
|
// - Hide toc
|
|
// - Added Cover Image to the post
|
|
function BlogPostPageContent({sidebar, children}) {
|
|
const {metadata, toc} = useBlogPost();
|
|
const {nextItem, prevItem, frontMatter, title} = metadata;
|
|
const {
|
|
hide_table_of_contents: hideTableOfContents,
|
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
} = frontMatter;
|
|
return (
|
|
<BlogLayout
|
|
sidebar={sidebar}
|
|
toc={undefined}
|
|
>
|
|
<BlogPostItem>
|
|
{frontMatter.coverImage && <figure>
|
|
<img
|
|
alt={`Banner for blog post with title "${title}"`}
|
|
className={clsx(styles.image, {
|
|
[styles["image--title"]]: children != null,
|
|
})}
|
|
src={frontMatter.coverImage}
|
|
loading="lazy"
|
|
/>
|
|
</figure>}
|
|
{children}
|
|
</BlogPostItem>
|
|
|
|
{(nextItem || prevItem) && (
|
|
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
|
|
)}
|
|
</BlogLayout>
|
|
);
|
|
}
|
|
export default function BlogPostPage(props) {
|
|
const BlogPostContent = props.content;
|
|
return (
|
|
<BlogPostProvider content={props.content} isBlogPostPage>
|
|
<HtmlClassNameProvider
|
|
className={clsx(
|
|
ThemeClassNames.wrapper.blogPages,
|
|
ThemeClassNames.page.blogPostPage,
|
|
)}>
|
|
<BlogPostPageMetadata />
|
|
<BlogPostPageContent sidebar={props.sidebar}>
|
|
<BlogPostContent />
|
|
</BlogPostPageContent>
|
|
</HtmlClassNameProvider>
|
|
</BlogPostProvider>
|
|
);
|
|
}
|