# Resolve embedded links to full URL

**URL:** <https://discourse.gohugo.io/t/resolve-embedded-links-to-full-url/57600>\
**Category:** support\
**Created:** [September 28, 2026, 3:01pm UTC](https://discourse.gohugo.io/t/resolve-embedded-links-to-full-url/57600 "2026-09-28T15:01:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![theory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/theory/32/5759_2.png) [@theory](https://discourse.gohugo.io/u/theory)\
**Post date:** [September 28, 2026, 3:01pm UTC](https://discourse.gohugo.io/t/resolve-embedded-links-to-full-url/57600/1 "2026-09-28T15:01:19Z")

</div>

I enabled embedded links resolution like so:

```auto
[markup.goldmark.renderHooks.link]
useEmbedded = "fallback"

```

This works great for `[xyz](/posts/xyz.md)`, except that the resolves URL is relative to the URL root, and I’d like it to be a full URL. I tried modifying the [default template](https://gohugo.io/render-hooks/links/#examples) to prefix `{{ .Page.Site.BaseURL }}`:

```auto
<a href="{{ .Page.Site.BaseURL }}{{ .Destination | safeURL }}"
  {{- with .Title }} title="{{ . }}"{{ end -}}
>
  {{- with .Text }}{{ . }}{{ end -}}
</a>
{{- /* chomp trailing newline */ -}}

```

But then it’s prepended to links that are already full; I end up with stuff like `href="``https://jusatheory.com/https://xyz.com``"`. Is there some other config I can adjust to get the full URL just for internally-resolved embedded links? Or else to prepend the base URL only to such internally-resolved links?

Thank you!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [September 28, 2026, 3:13pm UTC](https://discourse.gohugo.io/t/resolve-embedded-links-to-full-url/57600/2 "2026-09-28T15:13:01Z")

</div>

You may find some inspiration here:

> <https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_markup/render-link.html>

---

<div class="post-metadata">

**Author:** ![theory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/theory/32/5759_2.png) [@theory](https://discourse.gohugo.io/u/theory)\
**Post date:** [September 28, 2026, 3:50pm UTC](https://discourse.gohugo.io/t/resolve-embedded-links-to-full-url/57600/3 "2026-09-28T15:50:47Z")

</div>

Perfect, thank you. Here’s [my version](https://github.com/theory/justatheory/commit/1f9a457).

---

<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 28, 2026, 3:56pm UTC](https://discourse.gohugo.io/t/resolve-embedded-links-to-full-url/57600/4 "2026-09-28T15:56:00Z")

</div>

There is almost never a good reason to use `.BaseURL`.

Copy the embedded render hook, and change `.RelPermalink` to `.Permalink`.

---

<div class="post-metadata">

**Author:** ![theory](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/theory/32/5759_2.png) [@theory](https://discourse.gohugo.io/u/theory)\
**Post date:** [September 28, 2026, 4:30pm UTC](https://discourse.gohugo.io/t/resolve-embedded-links-to-full-url/57600/5 "2026-09-28T16:30:36Z")

</div>

Of course, thank you. I’ve done little with templates in a few years so forget all the bits.
