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

WIP: Use top-level markdown heading as default page Title #4359

Closed
wants to merge 1 commit into from
Closed

WIP: Use top-level markdown heading as default page Title #4359

wants to merge 1 commit into from

Conversation

vassudanagunta
Copy link
Contributor

@vassudanagunta vassudanagunta commented Jan 31, 2018

Supports content where the title is declared as the top level heading within the markdown itself rather than in front matter. Sets the Page's title variable only if it was not set via front matter. See this comment under #4341.

This is a POC/WIP. It is fully functional. It is implemented not by a regex scan of the content, but via a hook into the BlackFriday renderer. As I am still new to the Hugo codebase, I'm not sure if I picked the right place to code the hook and pass it into BlackFriday.

Since the hook is intercepting all BlackFriday heading render calls, it can also form the basis of a better TOC solution, with a proper data structure (I know @bep wants this!)

There are not yet config settings or tests, but need confirmation that this is indeed desired functionality first.

Supports content where the title is declared as the top level heading within the markdown itself rather than in front matter.
@bep
Copy link
Member

bep commented Feb 1, 2018

The idea is good, but doing this in Blackfriday 1 creates work down the line when we're going for v2, which is a daunting task on its own.

@vassudanagunta
Copy link
Contributor Author

Makes sense. If Blackfriday 2 gets us a nice TOC data structure, we could just pull the title out of that.

@bep
Copy link
Member

bep commented Feb 1, 2018

If Blackfriday 2 gets us a nice TOC data structure, we could just pull the title out of that.

It doesn't out of the box, but the API is totally different, so this PR will have to be somehow adapted/rewritten.

@vassudanagunta
Copy link
Contributor Author

vassudanagunta commented Feb 1, 2018

Ok, I'll close it. It will still exist for reference by the other discussions on metadata defaults. I'll keep my branch ready for when we get to BF2.

@github-actions
Copy link

github-actions bot commented Feb 7, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants