Find file based on pattern (Regex)

Let’s say I have the following three files in my static folder…

a-1.0.0.pdf
b-1.4.0.pdf
c-2.3.3.pdf

The user can download the files on my page

<a href="/a-1.0.0.pdf">Download</a>
<a href="/b-1.4.0.pdf">Download</a>
<a href="/c-2.3.3.pdf">Download</a>

The files (and of course their version numbers) update very often. If I update the file a-1.0.0.pdf to a-1.1.0.pdf I also have to change the respective href in my code.

Is there a Hugo function to find the file based on a pattern? (On Linux there is a find function). I don’t want to change the href every time I change the file.

Look at readDir and findRE. Also see this recent thread for an example from another user.

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