Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(v2): make not clickable post title on post item page #1962

Merged
merged 5 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ import MDXComponents from '@theme/MDXComponents';
import styles from './styles.module.css';

function BlogPostItem(props) {
const {children, frontMatter, metadata, truncated} = props;
const {
children,
frontMatter,
metadata,
truncated,
isBlogPostPage = false,
} = props;
const {date, permalink, tags} = metadata;
const {author, authorURL, authorTitle, authorFBID, title} = frontMatter;

Expand Down Expand Up @@ -45,7 +51,7 @@ function BlogPostItem(props) {
return (
<header>
<h1 className={classnames('margin-bottom--sm', styles.blogPostTitle)}>
<Link to={permalink}>{title}</Link>
{isBlogPostPage ? title : <Link to={permalink}>{title}</Link>}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better solution? Comparison with location.pathname will not work, what other options are there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the right solution (?). Determining whether it's a list or not using pathname parsing can lead to subtle bugs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this is a right way to check.

</h1>
<div className="margin-bottom--sm">
<small>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ function BlogPostPage(props) {
<div className="container margin-vert--xl">
<div className="row">
<div className="col col--8 col--offset-2">
<BlogPostItem frontMatter={frontMatter} metadata={metadata}>
<BlogPostItem
frontMatter={frontMatter}
metadata={metadata}
isBlogPostPage>
lex111 marked this conversation as resolved.
Show resolved Hide resolved
<BlogPostContents />
</BlogPostItem>
<div className="margin-vert--xl">
Expand Down