mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Enhance Page and Resource String()
This commit is contained in:
parent
fc8c5ad824
commit
4f0665f476
2 changed files with 8 additions and 2 deletions
|
@ -2013,7 +2013,11 @@ func (p *Page) RelRef(refs ...string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Page) String() string {
|
func (p *Page) String() string {
|
||||||
|
if p.Path() != "" {
|
||||||
|
return fmt.Sprintf("Page(%s)", p.Path())
|
||||||
|
}
|
||||||
return fmt.Sprintf("Page(%q)", p.title)
|
return fmt.Sprintf("Page(%q)", p.title)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scratch returns the writable context associated with this Page.
|
// Scratch returns the writable context associated with this Page.
|
||||||
|
|
|
@ -419,8 +419,6 @@ type genericResource struct {
|
||||||
// The relative path to this resource.
|
// The relative path to this resource.
|
||||||
relTargetPath dirFile
|
relTargetPath dirFile
|
||||||
|
|
||||||
file string
|
|
||||||
|
|
||||||
// Base is set when the output format's path has a offset, e.g. for AMP.
|
// Base is set when the output format's path has a offset, e.g. for AMP.
|
||||||
base string
|
base string
|
||||||
|
|
||||||
|
@ -554,6 +552,10 @@ func (l *genericResource) AbsSourceFilename() string {
|
||||||
return l.sourceFilename
|
return l.sourceFilename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *genericResource) String() string {
|
||||||
|
return fmt.Sprintf("Resource(%s: %s)", l.resourceType, l.name)
|
||||||
|
}
|
||||||
|
|
||||||
func (l *genericResource) Publish() error {
|
func (l *genericResource) Publish() error {
|
||||||
f, err := l.sourceFs().Open(l.AbsSourceFilename())
|
f, err := l.sourceFs().Open(l.AbsSourceFilename())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue