@@ -19,7 +19,6 @@ import (
1919 "fmt"
2020 "html/template"
2121 "io"
22- "strconv"
2322 "strings"
2423 "sync/atomic"
2524 "unicode/utf8"
@@ -69,12 +68,6 @@ func (m *pageMetaSource) parseFrontMatter(
6968 h * HugoSites ,
7069 sid uint64 ,
7170) error {
72- var sourceKey string
73-
74- if sourceKey == "" {
75- sourceKey = strconv .FormatUint (sid , 10 )
76- }
77-
7871 var filename string
7972 if m .f != nil {
8073 filename = m .f .Filename ()
@@ -83,7 +76,6 @@ func (m *pageMetaSource) parseFrontMatter(
8376 m .pi = & contentParseInfo {
8477 h : h ,
8578 sid : sid ,
86- sourceKey : sourceKey ,
8779 openSource : m .openSource ,
8880 shortcodeParseInfo : newShortcodeHandler (filename , h .Deps ),
8981 }
@@ -163,8 +155,7 @@ func (c *cachedContent) getOrCreateScope(scope string, pco *pageContentOutput) *
163155type contentParseInfo struct {
164156 h * HugoSites
165157
166- sid uint64
167- sourceKey string
158+ sid uint64
168159
169160 // The source bytes.
170161 openSource hugio.OpenReadSeekCloser
@@ -323,7 +314,7 @@ Loop:
323314 currShortcode .pos = it .Pos ()
324315 currShortcode .length = iter .Current ().Pos () - it .Pos ()
325316 if currShortcode .placeholder == "" {
326- currShortcode .placeholder = createShortcodePlaceholder ("s" , pi .sid , currShortcode .ordinal )
317+ currShortcode .placeholder = createShortcodePlaceholder ("s" , pi .sid , uint64 ( currShortcode .ordinal ) )
327318 }
328319
329320 if currShortcode .name != "" {
@@ -335,7 +326,7 @@ Loop:
335326 currShortcode .params = s
336327 }
337328
338- currShortcode .placeholder = createShortcodePlaceholder ("s" , pi .sid , ordinal )
329+ currShortcode .placeholder = createShortcodePlaceholder ("s" , pi .sid , uint64 ( ordinal ) )
339330 ordinal ++
340331 s .shortcodes = append (s .shortcodes , currShortcode )
341332
@@ -390,10 +381,10 @@ func (c *cachedContent) mustSource() []byte {
390381}
391382
392383func (pi * contentParseInfo ) contentSource (s resource.StaleInfo ) ([]byte , error ) {
393- key := pi .sourceKey
384+ key := pi .sid
394385 versionv := s .StaleVersion ()
395386
396- v , err := pi .h .cacheContentSource .GetOrCreate (key , func (string ) (* resources.StaleValue [[]byte ], error ) {
387+ v , err := pi .h .cacheContentSource .GetOrCreate (key , func (uint64 ) (* resources.StaleValue [[]byte ], error ) {
397388 b , err := pi .readSourceAll ()
398389 if err != nil {
399390 return nil , err
@@ -457,13 +448,13 @@ type contentPlainPlainWords struct {
457448}
458449
459450func (c * cachedContentScope ) keyScope (ctx context.Context ) string {
460- return hugo .GetMarkupScope (ctx ) + c .pco .po .f .Name
451+ return hugo .GetMarkupScope (ctx ) + c .pco .po .f .Name + fmt . Sprintf ( "_%d" , c . pi . sid )
461452}
462453
463454func (c * cachedContentScope ) contentRendered (ctx context.Context ) (contentSummary , error ) {
464455 cp := c .pco
465456 ctx = tpl .Context .DependencyScope .Set (ctx , pageDependencyScopeGlobal )
466- key := c .pi . sourceKey + "/" + c . keyScope (ctx )
457+ key := c .keyScope (ctx )
467458
468459 versionv := c .version (cp )
469460
@@ -616,7 +607,7 @@ var setGetContentCallbackInContext = contexthelpers.NewContextDispatcher[func(*p
616607
617608func (c * cachedContentScope ) contentToC (ctx context.Context ) (contentTableOfContents , error ) {
618609 cp := c .pco
619- key := c .pi . sourceKey + "/" + c . keyScope (ctx )
610+ key := c .keyScope (ctx )
620611 versionv := c .version (cp )
621612
622613 v , err := c .pm .contentTableOfContents .GetOrCreate (key , func (string ) (* resources.StaleValue [contentTableOfContents ], error ) {
@@ -737,7 +728,7 @@ func (c *cachedContent) version(cp *pageContentOutput) uint32 {
737728
738729func (c * cachedContentScope ) contentPlain (ctx context.Context ) (contentPlainPlainWords , error ) {
739730 cp := c .pco
740- key := c .pi . sourceKey + "/" + c . keyScope (ctx )
731+ key := c .keyScope (ctx )
741732
742733 versionv := c .version (cp )
743734
0 commit comments