Is there anyway at build-time in Jekyll to reprocess the links for a set of files? I am trying to include some markdown created for another system. In that system, the links needs to look like this:
[Quick Start](#pages/getting-started/quick-start.html)
My directory looks like this:
/product1
+--- /getting-started
+--- quick-start.md
I need to replace the #pages
with /product1
so it looks more like this:
[Quick Start](/product1/getting-started/quick-start.html)
Any thoughts on whether or not it can be done? Or do I need to pre-process the files before pulling them into Jekyll.
1 Like
You could write a ruby plugin to be run at build time. I’ve seen plugins covered in the forum for changing markdown.
Or you can use a shell script using grep to find and replace URLs and commit the updates. VS Code has nice regex groupong support in its find and replace functionality if you don’t want to write a script.
I think the 2nd option is better.
Additional if you use the link
Jekyll tag you’ll get alerted if any links go to pages that don’t exist.
[Quickstart]({{ site.baseurl }}{% link _product1/getting-startes/quickstart.md %})
Outputs like this
<a href="/my-repo/product1/getting-started/quickstart.html">
Quickstart
</a>
2 Likes