# Links rendering issue

**URL:** <https://discourse.gohugo.io/t/links-rendering-issue/50200>\
**Category:** support\
**Created:** [June 7, 2024, 3:20pm UTC](https://discourse.gohugo.io/t/links-rendering-issue/50200 "2024-06-07T15:20:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vbtd](https://avatars.discourse-cdn.com/v4/letter/v/df788c/32.png) [@vbtd](https://discourse.gohugo.io/u/vbtd)\
**Post date:** [June 7, 2024, 3:20pm UTC](https://discourse.gohugo.io/t/links-rendering-issue/50200/1 "2024-06-07T15:20:16Z")

</div>

Found nothing about my problem. My Hugo version is 0.108, OS is Windows 10 19045.4412

So, I have a YAML-file, which contains the following field:

```auto
external_link: https://hello.world.whats.app/lets/go/for/walk

```

Also, I have a shortcode for reading from this file:

```auto
{{- $dataPath := .Get 0 -}}
{{- with split $dataPath "." -}}
    {{- $data := site.Data -}}
    {{- range . -}}
        {{- $data = index $data . -}}
    {{- end -}}
    {{- $data -}}
{{- end -}}

```

And I have following markdown:

```auto
[external link from file]({{< get-site-data "yaml_file.external_link" >}})

[external link hard-coded](https://hello.world.whats.app/lets/go/for/walk)

```

I created `render-link.html` hook for processing them, but I see the strange behavior with the link which is read from the file.  
When I do

```auto
strings.Contains .Destination "http"

```

It returns false for [external link from file], but true for [external link hard-coded]. I tried to output this `.Destination`, but it is almost the same for both links.

When I run

```auto
{{- $urlData := urls.Parse .Destination -}}
{{- $urlData.IsAbs -}}

```

It prints false and true correspondingly.

---

<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:** [June 7, 2024, 3:40pm UTC](https://discourse.gohugo.io/t/links-rendering-issue/50200/2 "2024-06-07T15:40:42Z")

</div>

This is an educated guess, but still a guess. Try calling the shortcode using the `{{% %}}` notation.

---

<div class="post-metadata">

**Author:** ![vbtd](https://avatars.discourse-cdn.com/v4/letter/v/df788c/32.png) [@vbtd](https://discourse.gohugo.io/u/vbtd)\
**Post date:** [June 7, 2024, 3:50pm UTC](https://discourse.gohugo.io/t/links-rendering-issue/50200/3 "2024-06-07T15:50:08Z")

</div>

Woooooow, it works! Thanks!  
But why, what is the reason? 😵‍💫

---

<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:** [June 7, 2024, 3:53pm UTC](https://discourse.gohugo.io/t/links-rendering-issue/50200/4 "2024-06-07T15:53:46Z")

</div>

When using the `{{< >}}` notation Hugo replaces the shortcode call with a placeholder (e.g., `HAHAHUGOSHORTCODE-SOMETHING`), then the markdown renderer does its thing, then we replace the placeholder with the rendered shortcode.

So the render hook was seeing `HAHAHUGOSHORTCODE-SOMETHING` instead of the URL.

---

<div class="post-metadata">

**Author:** ![vbtd](https://avatars.discourse-cdn.com/v4/letter/v/df788c/32.png) [@vbtd](https://discourse.gohugo.io/u/vbtd)\
**Post date:** [June 7, 2024, 5:15pm UTC](https://discourse.gohugo.io/t/links-rendering-issue/50200/5 "2024-06-07T17:15:36Z")

</div>

Thank you so much I found docs about it and it’s clear now 😅

---

<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:** [June 9, 2024, 5:16pm UTC](https://discourse.gohugo.io/t/links-rendering-issue/50200/6 "2024-06-09T17:16:30Z")

</div>

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