mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 12:47:14 +02:00
fix(v2): make not clickable post title on post item page (#1962)
* fix(v2): make not clickable post title on post item page * Refactor: move to props * refactor: use explicit boolean value * Revert last commit
This commit is contained in:
parent
b1867e99be
commit
ae1dec543e
2 changed files with 12 additions and 3 deletions
|
@ -15,7 +15,13 @@ import MDXComponents from '@theme/MDXComponents';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
||||||
function BlogPostItem(props) {
|
function BlogPostItem(props) {
|
||||||
const {children, frontMatter, metadata, truncated} = props;
|
const {
|
||||||
|
children,
|
||||||
|
frontMatter,
|
||||||
|
metadata,
|
||||||
|
truncated,
|
||||||
|
isBlogPostPage = false,
|
||||||
|
} = props;
|
||||||
const {date, permalink, tags} = metadata;
|
const {date, permalink, tags} = metadata;
|
||||||
const {author, authorURL, authorTitle, authorFBID, title} = frontMatter;
|
const {author, authorURL, authorTitle, authorFBID, title} = frontMatter;
|
||||||
|
|
||||||
|
@ -45,7 +51,7 @@ function BlogPostItem(props) {
|
||||||
return (
|
return (
|
||||||
<header>
|
<header>
|
||||||
<h1 className={classnames('margin-bottom--sm', styles.blogPostTitle)}>
|
<h1 className={classnames('margin-bottom--sm', styles.blogPostTitle)}>
|
||||||
<Link to={permalink}>{title}</Link>
|
{isBlogPostPage ? title : <Link to={permalink}>{title}</Link>}
|
||||||
</h1>
|
</h1>
|
||||||
<div className="margin-bottom--sm">
|
<div className="margin-bottom--sm">
|
||||||
<time dateTime={date} className={styles.blogPostDate}>
|
<time dateTime={date} className={styles.blogPostDate}>
|
||||||
|
|
|
@ -20,7 +20,10 @@ function BlogPostPage(props) {
|
||||||
<div className="container margin-vert--xl">
|
<div className="container margin-vert--xl">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col col--8 col--offset-2">
|
<div className="col col--8 col--offset-2">
|
||||||
<BlogPostItem frontMatter={frontMatter} metadata={metadata}>
|
<BlogPostItem
|
||||||
|
frontMatter={frontMatter}
|
||||||
|
metadata={metadata}
|
||||||
|
isBlogPostPage>
|
||||||
<BlogPostContents />
|
<BlogPostContents />
|
||||||
</BlogPostItem>
|
</BlogPostItem>
|
||||||
{(metadata.nextItem || metadata.prevItem) && (
|
{(metadata.nextItem || metadata.prevItem) && (
|
||||||
|
|
Loading…
Add table
Reference in a new issue