Website
Website copied to clipboard
Error when using the example to change the default cross reference name
I get an error logged when I try and use the example from https://www.statiq.dev/guide/web/content-files/links-and-cross-references#changing-the-default-cross-reference-name (specifically the _directory.yml one)
Xref: => Config.FromDocument(doc => doc.Destination.FileNameWithoutExtension.Replace(' ', '-'))
Error:
[ERRO] 1 errors compiling script:
Line 1: CS1929: 'NormalizedPath' does not contain a definition for 'Replace' and the best extension method overload 'MemoryExtensions.Replace(in Memory<char>, char, char)' requires a receiver of type 'in Memory<char>'
[ERRO] Content/PostProcess » RenderContentPostProcessTemplates » ResolveXrefs » Exception of type 'Statiq.Core.ScriptCompilationException' was thrown.
[ERRO] Archives/PostProcess » ExecuteSwitch » RenderContentPostProcessTemplates » ResolveXrefs » Exception of type 'Statiq.Core.ScriptCompilationException' was thrown.
I changed the setting to this (adding the .GetTitle()
) and the error was resolved:
Xref: => Config.FromDocument(doc => doc.Destination.FileNameWithoutExtension.GetTitle().Replace(' ', '-'))
If that is the correct fix I'm happy to raise a PR