Comments (5)
See #12438
from hugo.
@bep It seems that you didn't read this issue. I linked to #12438 in it. What are your thoughts on the points I made in this issue?
from hugo.
@bep Also, if the ultimate decision is to not revert the .PublishDate behavior, then we should follow through and fix the .PublishDate documentation to reflect the current behavior:
With Hugo’s default configuration, the PublishDate method returns the front matter value. This behavior is configurable, allowing you to set fallback values if the publish date is not defined in front matter.
from hugo.
With Hugo’s default configuration, the PublishDate method returns the front matter value. This behavior is configurable, allowing you to set fallback values if the publish date is not defined in front matter.
The above is still correct. If you add publishDate
to front matter in e.g. mysection/_index.md
then that is the value that's getting published.
The current behaviour matches how we treat both date and lastMod and is what most people would expect.
If you don't want to show publishDate
for sections, then you can do a {{ if .IsPage }}{{ .PublishDate }}{{ end }}
or something..
from hugo.
The above is still correct.
But it's incorrect if no date-like params are set. For other page kinds, if no date-like params are set, then .PublishDate is time.Time{}. That isn't the case for list pages. This special list page behavior is unspecified here and elsewhere.
If you don't want to show publishDate for sections, then you can do a {{ if .IsPage }}{{ .PublishDate }}{{ end }} or something.
I do want to show it if a date-like param is set, according to the configured fallbacks. As I pointed out above, there's currently no portable way to do this.
The current behaviour matches how we treat both date and lastMod
Then my argument should apply to them too. That does admittedly increase the scope of change. If you don't want to make breaking changes (again) like that, then I understand, but then how about a new field that implements the previous behavior? Something like PAGE.PublishDateNotRecursive (similar to PAGE.RegularPagesRecursive)?
(Edited)
from hugo.
Related Issues (20)
- Check site.GetPage /news vs /tags/news
- Encountering "The system cannot find the path specified" error when using `nul` as taxonomy on Windows.
- Reimplement the browser livereload logic
- Edit of of functions/_common/* in Hugo Docs not reflected on server rebuilds HOT 1
- livereload.ForceRefresh doesn't (always) work in Chrome HOT 1
- hugo server -N behaves oddly when editing headless content
- Apple MacOS ARM64 broken build for large sites "Error: error building site: TOCSS: failed to transform" HOT 5
- navigation.Page is nil for taxonomy pages (Hugo v0.128.2+) HOT 3
- Performance Improvements in Template Execution HOT 3
- Deferred template crashes server HOT 5
- Fingerprint appended twice causing file name too long
- Adjust gitmap execution HOT 1
- Ability to customize the fingerprint delimiter that goes in between the filename and extension
- extend version on Mac gives "ld: warning: ignoring duplicate libraries: '-lc++', '-lm'" error massed on go install HOT 3
- Emoji :melting_face: Unable to render HOT 2
- YAML format not set in front matter HOT 2
- Invalid URL for the author page if multiple authors are enabled HOT 1
- exif: Warning when GPS lat/long not set HOT 1
- Unicode Bidirectional Algorithm Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugo.