gohugoio/hugo

html content does not include summary, whereas md content does

Dieterbe opened this issue · 9 comments

What version of Hugo are you using (hugo version)?

current git build (v0.62.0-3-gaa4ccb8a)

$ hugo version
Hugo Static Site Generator v0.63.0-DEV linux/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

Yes, tested with 0.62.0 official release as well.

can easily be reproduced like so:

mkdir hugo-test
cd hugo-test
hugo new site quickstart && cd quickstart
mkdir themes && cd themes && git clone https://github.com/yanlinlin82/simple-style.git && cd ..
echo 'theme = "simple-style"' >> config.toml
mkdir content/post
cat <<EOF > content/post/mdpost.md
---
title: "Mdpost"
date: 2019-12-30T15:21:57+01:00
draft: false
---
summary
<!--more-->
content
EOF
cat <<EOF > content/post/htmlpost.html
---
title: "Htmlpost"
date: 2019-12-30T15:21:15+01:00
draft: false
---
summary
<!--more-->
content
EOF
hugo server

when you load the html post and the md post in your browser, you can see that the html post does not include the summary, but the markdown does.

Thank you for reporting this. I will check if this is a problem in my theme ('simple-style').

no, the problem is the {{.Content}} variable, sometimes it contains the summary part of the content, sometimes it only contains the part of the content after the summary divider.

I see. thanks!

stale commented

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

Please re-open.

Just a note that if we do want to change this behavior, the place to look is in this if block or, if #9423 is merged, in this function.

As it stands now, there is an integration test assertion that HTML content must not include the main content, so the solution might be to document this discrepancy.

This was resolved in v0.134.0.

confirmed. thank you!

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