# Reprocessing markdown links

**URL:** <https://talk.jekyllrb.com/t/reprocessing-markdown-links/5234>\
**Category:** Help\
**Created:** [November 18, 2020, 1:15am UTC](https://talk.jekyllrb.com/t/reprocessing-markdown-links/5234 "2020-11-18T01:15:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhedblom](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@mhedblom](https://talk.jekyllrb.com/u/mhedblom)\
**Post date:** [November 18, 2020, 1:15am UTC](https://talk.jekyllrb.com/t/reprocessing-markdown-links/5234/1 "2020-11-18T01:15:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [November 18, 2020, 11:38am UTC](https://talk.jekyllrb.com/t/reprocessing-markdown-links/5234/2 "2020-11-18T11:38:00Z")

</div>

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.

```auto
[Quickstart]({{ site.baseurl }}{% link _product1/getting-startes/quickstart.md %})

```

Outputs like this

```auto
<a href="/my-repo/product1/getting-started/quickstart.html">
  Quickstart
</a>

```
