# Missing link render hook attributes

**URL:** <https://discourse.gohugo.io/t/missing-link-render-hook-attributes/46240>\
**Category:** feature\
**Created:** [September 16, 2023, 4:45am UTC](https://discourse.gohugo.io/t/missing-link-render-hook-attributes/46240 "2023-09-16T04:45:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![will](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/will/32/18403_2.png) [@will](https://discourse.gohugo.io/u/will)\
**Post date:** [September 16, 2023, 4:45am UTC](https://discourse.gohugo.io/t/missing-link-render-hook-attributes/46240/1 "2023-09-16T04:45:26Z")

</div>

> **[Markdown render hooks](https://gohugo.io/templates/render-hooks/#context-passed-to-render-link-and-render-image)**
>
> Render Hooks allow custom templates to override markdown rendering functionality.

There is only page, destination, title, text, and plain text. If a link has class or style attributes originally, they are lost.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 16, 2023, 4:48am UTC](https://discourse.gohugo.io/t/missing-link-render-hook-attributes/46240/2 "2023-09-16T04:48:33Z")

</div>

Not sure I understand. You can attach markdown attributes to images, headings, and fenced code blocks – so the `.Attributes` map is available in those render hooks.

---

<div class="post-metadata">

**Author:** ![will](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/will/32/18403_2.png) [@will](https://discourse.gohugo.io/u/will)\
**Post date:** [September 16, 2023, 5:23am UTC](https://discourse.gohugo.io/t/missing-link-render-hook-attributes/46240/3 "2023-09-16T05:23:47Z")

</div>

I was referring to render-link.html in particular. But I didn’t realize it only runs for Markdown links, not all links, and there doesn’t seem to be a way to specify attributes for Markdown links, as far as I can tell. So it’s a moot point.

---

<div class="post-metadata">

**Author:** ![Tom\_Durand](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tom_durand/32/14460_2.png) [@Tom\_Durand](https://discourse.gohugo.io/u/Tom_Durand)\
**Post date:** [September 16, 2023, 8:06am UTC](https://discourse.gohugo.io/t/missing-link-render-hook-attributes/46240/4 "2023-09-16T08:06:37Z")

</div>

yes, because it’s not a block element.  
But that said… would it be costly (in term of build time) to add the following syntax ?  
`[title](destination "text" {.class #link})`  
The curly brackets would prevent the confusion with the destination. Only issue, that would only work with enclosed inline elements.  
`*element{#id .class}*` could work too. Same with list elements, while the list itself requires the attribute on the next line:

```auto
- element 1 {.class_element}
- element 2
{.class_list}

```

There would just be the issue of the _code_ element (sticks), I think. I know you do not define the norm, but maybe as an extension ?

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [September 18, 2023, 8:07am UTC](https://discourse.gohugo.io/t/missing-link-render-hook-attributes/46240/5 "2023-09-18T08:07:13Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
