gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
73.61k stars 7.39k forks source link

html content does not include summary, whereas md content does #6686

Open Dieterbe opened 4 years ago

Dieterbe commented 4 years ago

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.

yanlinlin82 commented 4 years ago

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

Dieterbe commented 4 years ago

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.

yanlinlin82 commented 4 years ago

I see. thanks!

stale[bot] commented 4 years ago

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.

jmooring commented 3 years ago

Please re-open.

ptgott commented 2 years ago

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.