How to detect presence of link in post content

How to detect and remove links inside post body? Any filter available?

What is reason for removing links and what will go in place of the link so the sentence etc. doesn’t look broken?

You can try edit a post layout.

And use replace filter or some regex replace to remove a link.

{{ content | some-filter }}

You can try strip_html as a filter too. It will convert a link to plain text I think but will also remove bold, H2 etc so your post becomes text only.

There have been discussions on the forum in the last few months regarding using a Jekyll Ruby plugin to find markdown links and convert them into another link format. Or the other way around. The Ruby code and regex pattern there will help you.

For example you can make a custom tag or filter which can be used for content as in the layout above

@MichaelCurrin Thanks for the help

1 Like