hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 4f0665f476e06e9707621c18f7422fdeb776e0d1
parent fc8c5ad824160cbf0868a8fb54c24a382626c73c
Author: Vas Sudanagunta <vas@commonkarma.org>
Date:   Fri, 25 May 2018 19:59:58 -0400

Enhance Page and Resource String()

Diffstat:
Mhugolib/page.go | 4++++
Mresource/resource.go | 6++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hugolib/page.go b/hugolib/page.go
@@ -2013,7 +2013,11 @@ func (p *Page) RelRef(refs ...string) (string, error) {
 }
 
 func (p *Page) String() string {
+	if p.Path() != "" {
+		return fmt.Sprintf("Page(%s)", p.Path())
+	}
 	return fmt.Sprintf("Page(%q)", p.title)
+
 }
 
 // Scratch returns the writable context associated with this Page.
diff --git a/resource/resource.go b/resource/resource.go
@@ -419,8 +419,6 @@ type genericResource struct {
 	// The relative path to this resource.
 	relTargetPath dirFile
 
-	file string
-
 	// Base is set when the output format's path has a offset, e.g. for AMP.
 	base string
 
@@ -554,6 +552,10 @@ func (l *genericResource) AbsSourceFilename() string {
 	return l.sourceFilename
 }
 
+func (l *genericResource) String() string {
+	return fmt.Sprintf("Resource(%s: %s)", l.resourceType, l.name)
+}
+
 func (l *genericResource) Publish() error {
 	f, err := l.sourceFs().Open(l.AbsSourceFilename())
 	if err != nil {