[SOLVED] Shortcode receiving raw HTML stopped working (missing goldmark setting)

Wow, this was a surprise. Especially as I can’t find any errors in logs or --logLevel, build or anything.

I have a working website for a Buddhist practice community. It employs numerous shortcodes. It builds and serves locally, and publishes without error. Here is an example of one of the pages, with three audio files reference using an {{ < audio > }} code.

I began building out a parallel project based on this one. It uses the same almost everything. I have been building and publishing without issue, the latest push/build about two hours ago. And here is the associated page on the new site. The Audio shortcode is fine.

I created a new .md content file in the old site and published it. All good. I copied and pasted that file into my en-us directory, renamed it, and ran a build. It worked fine. There was a little formatting in my file that I didn’t like, so I used markdown > to blockquote a portion of the text. That also was fine, but wasn’t an attractive solution. So I used another shortcode I have all over the place, {{ < indent > }} to push in an indented < span >. This would have been a nested shortcode… but already used this way in numerous other locations.

Somewhere in this or the next build, there was a problem constructing the site. No error, but the Audio HTML no longer appeared. Looking further, I found that NO SHORTCODES were being resolved at all, anywhere! I looked at the published files in my docs folder – BLANK where the shortcodes would have resolved. What the heck!

I have tried the following, in order of increasing frustration and/or panic. None of them have corrected the issue:

  1. Removed the shortcode – guess something didn’t like it.
  2. Reverted the file to original via git.
  3. Removed the file altogether. The site and content is now identical to where I successfully built one hour earlier.
  4. Reverted to a GIT release from yesterday … expression has changed from WTH to WTF?
  5. Restarted vscode.
  6. Rebooted the machine.
  7. Created new git repo from the (successful!) build this morning … WTF? => WTF?!
  8. Looked at the Hugo site for troubleshooting, running log @ debug

… ran template metrics, and the shortcodes are appearing…?

… ran the audit command on my (public) /docs folder, which resulted in a bunch of lines but nothing I could identify as an issue:

HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo && grep -inorE “<–header raw HTML omitted -->|ZgotmplZ|[i18n]|()|(<nil>)|hahahugo” docs/ | less

The WTF??!! here is that I am running a common executable on both web sites, and a new clone of the existing, built and functioning repo, in a separate folder, ALSO does not load the shortcodes. The original site continues to build and present fine, both locally and on the server.

Gentlepeople, where in tarnation do I go from here? IS there anything else I can test?

Fedora Linux 40, intel Core i7, 32GB RAM, 256GB SSD, all resources plentiful.
VS Code 1.91.0
Not using a theme
Did not post a particular shortcode, since ALL of them are failing, for this repo only

also to no avail…

  • Cleared vscode editor cache ctrl-shift-P > clear editor cache
  • hugo mod clean --all => Deleted 0 files from module cache
  • hugo serve --ignoreCache => no change
  • hugo serve --ignoreCache --renderStaticToDisk --cleanDestinationDir => no change
  • upgraded to Hugo 128

Hard to investigate without the source files

So just two estimated guesses where ro look at

Sometimes manually deleting public and resources folder helps

Maybe the theme has been updated an your fresh clone is using a different version

Thank you. I am using no theme. There (should be) no need for source files, since reverting to a clean repo that functioned only two hours ago made no difference, even in a clean folder. And remember, it was working, then NOT working, with no real changes to any code, just one content .MD file.

That said, I am ready to supply any files that have some chance of helping a diagnosis!

I did delete the public ('docs") folder, and have done it again. This is my “resources” folder:

Screenshot from 2024-07-04 14-57-58

I deleted both – no change! I went to my repo, moved back two days, and cloned that specific version into a new folder – no change! That is the version that worked this morning.

So there must be a change… your pages look different. The markers 《 around each paragraph and the image at the end are different.

I would diff the working and non working file tree source and target

Guess you did not update hugo itself :slight_smile:

Maybe changes in vscode setup. Eg formatting, fe prettier formatter breaks go templates sometimes

Thanks for giving this attention, Irkode. I agree, something must have changed. But as far as I can tell, it is something beyond the repo. Remember, I pulled the old code from the repo, the one that published without error, and it fails identically. The repo is not at fault, and hugo is not at fault. But what is?

The pages are in two separate projects: twin projects. The first one continues to build without issue – proving (I believe) that the hugo ecosystem itself is not affected. The second page is working – I built it and published it 30 minutes before things stopped working in that repo. The only change was what I mentioned: ONE content file added. One change to the content itself. Nothing else changed at all.

I’d better load this all on another machine, and see what happens. Crazy. 40 years of coding, 8 or 9 years of Hugo, this is a new one.

so sometime there at least was a difference :wink:

dealing with the black box - no more ideas

all I can offer you is to have a look and try it in my environment

Thanks for thinking about this. However, when I revert to a copy of the full site from two days ago, where everything built fine, and it does not work, it has nothing to do with your imagined “changes”. This was before any change occurred. It is apparently a platform thing.

If someone can explain why a fresh copy of the previously-proven repo, in a fresh directory, still does not build, we’ll be getting somewhere.

1 Like

Without access to your repo? That would be guess work.

Any externals involved like. Node npm dart sass, ruby …

U may setup a fresh os in a vm

And just for fun wrong branch…? Maybe compare stuff in the remote repo

there’s also a --gc switch for garbage collect
did you manually delete the caches on windows I have two possible locations.

%APPDATA%\go-build
%APPDATA%\go-cache

see: Configure Hugo | Hugo

and I would stick with the original version of hugo - upgraded hugo may behave different.

and I suppose you did that all (git co, and build) also in a pure shell without vscode or other stuff involved.

what about hugo without server…and check generated files…

Thanks for your thoughts, irkode.

I moved to my work (Windows) computer, downloaded latest version of hugo and built the current site. It failed. Ok, so it is not some phantom presence on my Linux dev machine.

Cleared node, cleared caches [ALMOST] everywhere on Linux and Windows. No joy. What is driving me crazy is that the current commit of my repo builds fine through Netlify – no errors – and it is presenting perfectly on my browsers, both Linux and Windows.

OR SO I THOUGHT. I went through the entire Netlify build log, no errors, no errors, no errors. At the bottom of everything, it said “Browse your build files”, so I did. In place of the shortcodes, blank.

I didn’t have my browser dev settings set to ignore the browser cache. The BROWSER cache. So I was looking at a ghost from the past the whole time, and my current build failed. That was the clue I was looking for. Dang it.

So thank you for your patience and your thoughts. Now I have a chance to go back into my commits and find the last functional build. If I figure out the issue, I’ll report back here for posterity’s sake; and if I can’t track it down, I’ll bleat for help, and of course offer access to my repo (will need to make it public, or send a link to anyone who cares to dissect it).

Thanks again

I hope the best.

Hope that does not mean you have the blanks from your first post in your source.

P.s.
No need to publish the repo, you could just add one or the other temporary to it

Thank you for your time with this, irkode. I now see WHERE the issue is happening (a shortcode that wraps .Inner content, and that inner content is HTML – has been working for years, but now is NOT on this site, and IS on the sister site. Probably need to rethink my strategy).

In any case, I will close this ticket, as I made a lot of noise thinking the built site was working, when it is not. I will open a new ticket with the true issue.

This thread is still thinking: “why oh why does the same technique still work on the old site, and not here?” Building with the same version of Hugo, and not leveraging any node dependencies… oh well.

I will reopen and document any insight that comes up, after I get the new site building correctly. Something with raw HTML and loading through a shortcode.

OK. the offending shortcode was receiving raw HTML for the .Inner, which I use all over the place. The difference between sites:

Screenshot from 2024-07-05 09-35-07

the setting to allow unsafe HTML was missing in the site – I had moved a huge chunk of translations from the hugo.yaml file into i18n files. I deleted the bottom block of param/transdlations without noticing it had my goldmark override settings there. completely an “own goal”

thanks for your patience. hope this little tidbit helps someone, sometime.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.