Skip to content

Fix EXECUTE-AS-TEMPLATE error with offline-search-index.json (issue #705)#710

Merged
LisaFC merged 2 commits intogoogle:masterfrom
tekezo:issue/705
Oct 4, 2021
Merged

Fix EXECUTE-AS-TEMPLATE error with offline-search-index.json (issue #705)#710
LisaFC merged 2 commits intogoogle:masterfrom
tekezo:issue/705

Conversation

@tekezo
Copy link
Copy Markdown
Contributor

@tekezo tekezo commented Oct 4, 2021

Fix the following error with Hugo 0.88.1 when offline search is enabled and the document contains {{.

Error: Error building site: EXECUTE-AS-TEMPLATE: failed to transform "offline-search-index.json" (application/json): failed to parse Resource "offline-search-index.json" as Template:: template: offline-search-index.json:750: comment ends before closing delimiter

@LisaFC
Copy link
Copy Markdown
Collaborator

LisaFC commented Oct 4, 2021

Excellent, thanks!

@LisaFC LisaFC merged commit bba090a into google:master Oct 4, 2021
Copy link
Copy Markdown
Collaborator

@chalin chalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's possibly move the discussion to #713.

Comment on lines -4 to -10
{{ $offlineSearchIndex := resources.Get "json/offline-search-index.json" | resources.ExecuteAsTemplate "offline-search-index.json" . }}
{{ $offlineSearchLink := $offlineSearchIndex.RelPermalink -}}
{{ if hugo.IsProduction -}}
{{/* Use `md5` as finger print hash function to shorten file name to avoid `file name too long` error. */}}
{{ $offlineSearchIndexFingerprint := $offlineSearchIndex | resources.Fingerprint "md5" }}
{{ $offlineSearchLink = $offlineSearchIndexFingerprint.RelPermalink -}}
{{ end -}}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change reverts #691. Again, I don't know if this is by mistake or by design, but it seems to be happening a little too often IMHO.

I'm wondering if it is a process issue where folks aren't working from the latest version of docsy and simply cause updates to be lost (reverted) when they commit. It might be worth having a discussion about this, WDYT @LisaFC?

/cc @celestehorgan @nate-double-u

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, #714 is a proposed fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the CLA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants