nhoizey / eleventy-plugin-link_to

A Nunjucks tag to link to another internal content in Eleventy with its slug.
MIT License
3 stars 0 forks source link

Make it possible to customize the link with some content from the target page #7

Open captainbrosset opened 8 months ago

captainbrosset commented 8 months ago

For context: https://mamot.fr/@nhoizey/111449404487082982

I'm looking for a way to transform, at build time, links between pages of my 11ty site.

Here is my scenario:

What I'm looking for is a way to transform this link so it includes more than just the text I provide in the markdown link tagging. For example, I would want be able to generate some custom HTML code like:

<a href="/pageB">
  <span class="title">The title of the pageB page</span>
  <span class="body">The first few characters of the pageB page content</span>
  <img src="/img/the-first-image-found-in-pageB.png">
</a>