Is there any way to have a list of auto linking based on words?

i am thinking about having a file like this

word1 =
word2 =
word3 =

so hugo would automatically add a link to those words if they are found in any post

Hugo doesn’t provide an option to add such rules to the content parsers.

In this situation would there be a way to pre-process the content files before they are sent to the Hugo content parsers?

Currently, Hugo doesn’t include pre-processors like auto-linking words, minification of assets etc. You’ve to do it yourself, e.g. you could write a shell script that checks all content files for the occurrences of word1, word2 and co. and replace them with a link of your choice.

I know that Hugo does not currently support pre-processors to do auto-linking. I am asking if Hugo has support for hooks that external tools could use to inject themselves into the Hugo build pipeline.

For instance, I do not want links to hot words hard coded in my content. I want to the content processed each time I do a build, and have hot words be linked depending on config settings. (These configs would be outside of Hugo.)

In the same way that Hugo will call the external asciidoc command when content is asciiDoc format, I would like to have Hugo call my custom scripts to transform the content when I configure it to do so.

In this way Hugo outputs text to a command and gets back text from that command. It just needs to be configured for which specific command and at which point in the Hugo build pipeline it is run.

No. It has been discussed and it will happen.


Did someone already write a script for that (haven’t found anything in a short search yet)?

Did think about just using sed on all *.md files under content searching for the hotwords and wrap it around like [hotword](link) and having a config file with key=value pairs.

could be a simple sed with a lookaround to find [hotword] content without (link) afterwards and replaces it based on a dictionary file.
What I don’t like with this approach is the fact that it rewrites the sources, this adds some difficulties if I want to update the link for a hotword, how will it exactly detect if its an auto hotword or a link I did manually with exactly the same name by coincidence?
A way to write a hook that could do it on the fly right before hugo sends the markdown to the html processor would be the best way.

Another way which should be possible with the current hugo implementation is also to just do it as a shortcode having the dictionary be part of the site variables and a shortcode like {{% autolink hotword %}} which will replace the content in the md file with [hotword](link) and then the markdown processor can do its job.