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

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Nov 12, 2019

Motivation

On the post page, the title should not be clickable

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

image

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 12, 2019
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Nov 12, 2019

Deploy preview for docusaurus-2 ready!

Built with commit c0ea177

https://deploy-preview-1962--docusaurus-2.netlify.com

@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Nov 12, 2019

Deploy preview for docusaurus-preview ready!

Built with commit c0ea177

https://deploy-preview-1962--docusaurus-preview.netlify.com

@@ -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.

Copy link
Contributor

@endiliey endiliey left a comment

Choose a reason for hiding this comment

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

Actually I’m relying on this behavior 😂

This is personal preference but I think Its much more convenient for people to click on title rather than the read more.

Also, not all blog post has “Read more”. If there is no “<!—truncate” marker in the markdown, it wont have read more button

V1 also has this functionality
https://babeljs.io/blog/
https://docusaurus.io/blog/

@endiliey
Copy link
Contributor

https://endiliey.com/

@endiliey endiliey added the pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. label Nov 12, 2019
@lex111
Copy link
Contributor Author

lex111 commented Nov 12, 2019

Also, not all blog post has “Read more”. If there is no “<!—truncate” marker in the markdown, it wont have read more button

But in posts lists, the title will also remain clickable, isn't it? This change will only affect the post item page.

@endiliey endiliey removed the pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. label Nov 12, 2019
@endiliey
Copy link
Contributor

oops you are right. I misread it on mobile :(

Copy link
Contributor

@endiliey endiliey left a comment

Choose a reason for hiding this comment

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

cc @yangshun for another approval

@endiliey endiliey added pr: polish This PR adds a very minor behavior improvement that users will enjoy. pr: bug fix This PR fixes a bug in a past release. and removed pr: polish This PR adds a very minor behavior improvement that users will enjoy. labels Nov 12, 2019
@lex111
Copy link
Contributor Author

lex111 commented Nov 13, 2019

Is there anything else to do before it can be merged?

@endiliey
Copy link
Contributor

I think this is OK. I find it annoying too previously (the blog list page and item page had no different so i keep on clicking the same thing).

I'm not UI expert so I usually ask for @yangshun opinion on this. but LGTM

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

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

This is great, thanks! Please self-merge.

@lex111 lex111 merged commit ae1dec5 into facebook:master Nov 13, 2019
@lex111 lex111 deleted the fix-blog-1 branch November 13, 2019 22:15
@lex111 lex111 restored the fix-blog-1 branch April 18, 2020 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants