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

Display content/_index.md if it exists #119

Merged

Conversation

jamesericdavidson
Copy link
Contributor

Improvement for #109. Test if content/_index.md exists, instead of configuring enableFrontMatter.

I thought the condition for displaying content on the home page could be made more convenient for people switching themes, or who want to add native Hugo front matter without theme configuration.

@netlify
Copy link

netlify bot commented Aug 15, 2022

Deploy Preview for gokarna-hugo ready!

Name Link
🔨 Latest commit c99b6db
🔍 Latest deploy log https://app.netlify.com/sites/gokarna-hugo/deploys/62fbc6391df4cb000884c265
😎 Deploy Preview https://deploy-preview-119--gokarna-hugo.netlify.app/posts/theme-documentation-basics
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@yashmehrotra
Copy link
Collaborator

@jamesericdavidson The hugo build command is breaking, might want to make sure it works on your local first

@jamesericdavidson
Copy link
Contributor Author

jamesericdavidson commented Aug 16, 2022 via email

@jamesericdavidson
Copy link
Contributor Author

@yashmehrotra I committed a bad version of the file, but it's now fixed.

Additionally evaluating that content/_index.md isn't empty before creating an <hr> and empty <section>.

Comment on lines 224 to 227
### Displaying content on the homepage

Content to display on homepage below the social icons, using the contents of `content/_index.md`.

Copy link
Collaborator

@yashmehrotra yashmehrotra Aug 16, 2022

Choose a reason for hiding this comment

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

@jamesericdavidson This should not be deleted, this documentation is still useful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're right. I only wanted to remove the reference to enableFrontMatter.

This should've been an atomic commit as well, oops. Re-added.

@yashmehrotra
Copy link
Collaborator

Thanks, merging

@yashmehrotra yashmehrotra merged commit 0cd9c1e into gokarna-theme:main Aug 16, 2022
@jamesericdavidson jamesericdavidson deleted the homepage-content-file branch August 16, 2022 16:47
@jamesericdavidson
Copy link
Contributor Author

Thanks for merging

jamesericdavidson added a commit to jamesericdavidson/gokarna that referenced this pull request Sep 12, 2022
jamesericdavidson added a commit to jamesericdavidson/gokarna that referenced this pull request Jan 21, 2025
re-implement gokarna-theme#119 - the Hugo way of displaying front matter - without
breaking index-about.md (gokarna-theme#179)

https://gohugo.io/content-management/organization/#index-pages-_indexmd

if _index.md exists (and has content), print it
else, if index-about.md exists (without checking for file contents), print it
yashmehrotra pushed a commit that referenced this pull request Feb 1, 2025
* refactor(index): support _index.md

re-implement #119 - the Hugo way of displaying front matter - without
breaking index-about.md (#179)

https://gohugo.io/content-management/organization/#index-pages-_indexmd

if _index.md exists (and has content), print it
else, if index-about.md exists (without checking for file contents), print it

* style(css): rename markdown-content class

* docs: update _index.md filename

* style(index): remove hr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants