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

Enable summary for the post in blog #73

Open
aldrineeinsteen opened this issue Jul 13, 2020 · 11 comments
Open

Enable summary for the post in blog #73

aldrineeinsteen opened this issue Jul 13, 2020 · 11 comments
Labels
enhancement New feature or request

Comments

@aldrineeinsteen
Copy link

Enable summary into the posts of every blog

image

The blog post looks odd without any summary.

@kentnek
Copy link
Collaborator

kentnek commented Jul 13, 2020

oh yes I was thinking about this too. I don't mind adding an option to expose the summary, let me try that.

@jakewies
Copy link
Owner

jakewies commented Jul 13, 2020

Hey @aldrineeinsteen ! Thanks for your interest in this theme. Hugo themes are overridable, meaning Hugo will look at your project files to resolve a layout before it looks into the theme's files.

If you installed the theme following the README, you should have installed it at /themes/hugo-theme-codex. The page you are referring to is the blog list layout, which can be found at /themes/hugo-theme-codex/layouts/_default/list.html. If you wish to add a summary to each blog post, you can copy the contents of /themes/hugo-theme-codex/layouts/_default/list.html to your /layouts/_default/list.html or /layouts/blog/list.html if you are already using the _default list template.

From there you can inject a summary to each post.

EDIT: @kentnek, do you think it would be better to add this as a configurable option? This is a design decision, and honestly I don't have a preference. Since @aldrineeinsteen is the first to bring this to our attention, maybe it's not something we need to expose just yet, but can support on a one off basis.

@kentnek
Copy link
Collaborator

kentnek commented Jul 13, 2020

@jakewies oh yes it should be configurable, as I don't want to force that on other people either 😂 I actually had that in mind earlier as some of my blog posts already have the <--more--> summary divider, which is supported by the previous theme that I used.

@jakewies
Copy link
Owner

Good idea. How do you envision the configuration for this looking? I think we could separate the config.toml params by page. For example:

# config.toml

[params]
   # ... site params

   # ... blog params
   [blog]
     showSummary = true

This is just the first idea that came to my noggin. What do you think? Do you have another solution?

@jakewies
Copy link
Owner

Also, @aldrineeinsteen are you looking to have each blog post's description in the list template? The description of a blog post is defined in each post's frontmatter.description. Currently this value is being used as site metadata.

@kentnek
Copy link
Collaborator

kentnek commented Jul 13, 2020

@jakewies no he wanted to show Hugo's Content Summaries, which is defined in .Summary.

I actually wanted to make showSummary a site-wide param. Dealing with page-wide params is kinda tricky as the page's key ("blog") is not the same with every user's website. Also a showSummary in every page param complicates the config I think, if the user wants to show summaries in all pages.

@jakewies
Copy link
Owner

@kentnek ok cool I didn't know this was an option. I just tested it out, and the Rich Content example post outputs some wonky text because it uses shortcodes. From first glance it looks like the .Summary value and shortcodes don't play nice together.

@kentnek
Copy link
Collaborator

kentnek commented Jul 13, 2020

Hmm then I guess we can add in the <!--more--> divider before the rich content for the demo to work.

aldrineeinsteen added a commit to aldrineeinsteen/hugo-theme-codex that referenced this issue Jul 13, 2020
@aldrineeinsteen
Copy link
Author

Good idea. How do you envision the configuration for this looking? I think we could separate the config.toml params by page. For example:

# config.toml

[params]
   # ... site params

   # ... blog params
   [blog]
     showSummary = true

This is just the first idea that came to my noggin. What do you think? Do you have another solution?

I haven't thought of exposing the same as a configuration; i have pushed a code to display the summary by default along with pagination:

image

@aldrineeinsteen
Copy link
Author

Hmm then I guess we can add in the <!--more--> divider before the rich content for the demo to work.

Yes, when started adding summary found the pagination was missing, i have added the same in #75

aldrineeinsteen added a commit to aldrineeinsteen/hugo-theme-codex that referenced this issue Jul 13, 2020
 - enabling summary params variable
@aldrineeinsteen
Copy link
Author

Good idea. How do you envision the configuration for this looking? I think we could separate the config.toml params by page. For example:

# config.toml

[params]
   # ... site params

   # ... blog params
   [blog]
     showSummary = true

This is just the first idea that came to my noggin. What do you think? Do you have another solution?

Added support for configuration in #75

aldrineeinsteen added a commit to aldrineeinsteen/hugo-theme-codex that referenced this issue Jul 14, 2020
aldrineeinsteen added a commit to aldrineeinsteen/hugo-theme-codex that referenced this issue Jul 14, 2020
aldrineeinsteen added a commit to aldrineeinsteen/hugo-theme-codex that referenced this issue Jul 14, 2020
aldrineeinsteen added a commit to aldrineeinsteen/hugo-theme-codex that referenced this issue Jul 14, 2020
@jakewies jakewies added the enhancement New feature or request label Jul 14, 2020
aldrineeinsteen added a commit to aldrineeinsteen/hugo-theme-codex that referenced this issue Jul 14, 2020
- updating the configuration from params.blog to params
- documentation has been added to enable configuration of summary for blogs

Closes jakewies#73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants