shithub: hugo

Download patch

ref: 32344fe3db862584e3f926d63bdf33b7fa7d22f7
parent: 4d7fa9f114c62ae2ec12257203ed21b0e4d69a04
author: Bjørn Erik Pedersen <[email protected]>
date: Sun May 24 08:49:45 EDT 2020

Prevent WARNINGs in RenderString

--- a/hugolib/page__meta.go
+++ b/hugolib/page__meta.go
@@ -727,11 +727,16 @@
 		return converter.NopConverter, errors.Errorf("no content renderer found for markup %q", p.markup)
 	}
 
+	var id string
+	if !p.f.IsZero() {
+		id = p.f.UniqueID()
+	}
+
 	cpp, err := cp.New(
 		converter.DocumentContext{
 			Document:        newPageForRenderHook(ps),
-			DocumentID:      p.f.UniqueID(),
-			DocumentName:    p.f.Path(),
+			DocumentID:      id,
+			DocumentName:    p.Path(),
 			ConfigOverrides: renderingConfigOverrides,
 		},
 	)