mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Add path, kind and lang to content front matter
Note that none of these can be set via cascade (you will get an error) Fixes #11544
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019 The Hugo Authors. All rights reserved.
|
||||
// Copyright 2024 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -19,8 +19,6 @@ import (
|
||||
"github.com/gohugoio/hugo/common/htime"
|
||||
)
|
||||
|
||||
var _ Dated = Dates{}
|
||||
|
||||
// Dated wraps a "dated resource". These are the 4 dates that makes
|
||||
// the date logic in Hugo.
|
||||
type Dated interface {
|
||||
@@ -37,27 +35,6 @@ type Dated interface {
|
||||
ExpiryDate() time.Time
|
||||
}
|
||||
|
||||
// Dates holds the 4 Hugo dates.
|
||||
type Dates struct {
|
||||
FDate time.Time
|
||||
FLastmod time.Time
|
||||
FPublishDate time.Time
|
||||
FExpiryDate time.Time
|
||||
}
|
||||
|
||||
func (d *Dates) IsDateOrLastModAfter(in Dated) bool {
|
||||
return d.Date().After(in.Date()) || d.Lastmod().After(in.Lastmod())
|
||||
}
|
||||
|
||||
func (d *Dates) UpdateDateAndLastmodIfAfter(in Dated) {
|
||||
if in.Date().After(d.Date()) {
|
||||
d.FDate = in.Date()
|
||||
}
|
||||
if in.Lastmod().After(d.Lastmod()) {
|
||||
d.FLastmod = in.Lastmod()
|
||||
}
|
||||
}
|
||||
|
||||
// IsFuture returns whether the argument represents the future.
|
||||
func IsFuture(d Dated) bool {
|
||||
if d.PublishDate().IsZero() {
|
||||
@@ -79,19 +56,3 @@ func IsExpired(d Dated) bool {
|
||||
func IsZeroDates(d Dated) bool {
|
||||
return d.Date().IsZero() && d.Lastmod().IsZero() && d.ExpiryDate().IsZero() && d.PublishDate().IsZero()
|
||||
}
|
||||
|
||||
func (p Dates) Date() time.Time {
|
||||
return p.FDate
|
||||
}
|
||||
|
||||
func (p Dates) Lastmod() time.Time {
|
||||
return p.FLastmod
|
||||
}
|
||||
|
||||
func (p Dates) PublishDate() time.Time {
|
||||
return p.FPublishDate
|
||||
}
|
||||
|
||||
func (p Dates) ExpiryDate() time.Time {
|
||||
return p.FExpiryDate
|
||||
}
|
||||
|
Reference in New Issue
Block a user