Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Markdown links stripping trailing slash

Started by Ryan Spencer 9 years ago · 2 replies · 1596 views
9 years ago

I have lots of links in markdown that my SEO magician now wants to have trailing slashes on. I've done the find/replace, but the final slash is being removed in markdown processing.

If I put in [](/link/to/page/) I end up with <a href="/link/to/page"></a>. Why?

If I escape the last slash [](/link/to/page\/) I get what I am looking for, but this does not feel like a good solution. The next person that edits the page is likely to forget as it is an add syntax.

9 years ago

I'm not sure there's any benefit of having trailing slashes. When I did a quick search it basically turned up people saying you need to be consistent, either use slash or don't at the end, other than that it makes no difference to SEO.

That said, there's a lot of calculation going on within Grav when you put a path in the markdown for a link. It basically recalculates your current relative position, and resolves any relative links, it also handles other scenarios, that's why the link is changing.

9 years ago

Thanks for the reply. I have a Grav install sitting inside a Wordpress install and Apache keeps putting a trailing slash on that folder, which is the Grav root. Trying to be consistent per the SEO request, I was trying to add trailing slashes everywhere else, but I can see I'm fighting a losing battle.

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 1 year ago
6 1486 1 year ago
Content & Markdown · by Ton Haarmans, 2 years ago
10 1146 2 years ago
Content & Markdown · by Jan L'Am, 2 years ago
4 1015 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 925 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 1397 2 years ago