# How can I redirect to an external link on click of header of any blog?

**URL:** <https://discourse.gohugo.io/t/how-can-i-redirect-to-an-external-link-on-click-of-header-of-any-blog/9886>\
**Category:** support\
**Created:** [January 7, 2018, 2:48am UTC](https://discourse.gohugo.io/t/how-can-i-redirect-to-an-external-link-on-click-of-header-of-any-blog/9886 "2018-01-07T02:48:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![agrawalsuneet](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/agrawalsuneet/32/4898_2.png) [@agrawalsuneet](https://discourse.gohugo.io/u/agrawalsuneet)\
**Post date:** [January 7, 2018, 2:48am UTC](https://discourse.gohugo.io/t/how-can-i-redirect-to-an-external-link-on-click-of-header-of-any-blog/9886/1 "2018-01-07T02:48:24Z")

</div>

Hi,

I am very new to hugo. How can I redirect to an external link on click of the header of any blog?  
Currently, it is redirecting me to the details page of that blog. I want to change this flow and redirect it to some external link.

Thanks

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [January 7, 2018, 2:53am UTC](https://discourse.gohugo.io/t/how-can-i-redirect-to-an-external-link-on-click-of-header-of-any-blog/9886/2 "2018-01-07T02:53:15Z")

</div>

Please read about [requesting help](https://discourse.gohugo.io/t/requesting-help/9132?u=maiki), and add more details. Focus on one question at a time.

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [January 7, 2018, 3:47am UTC](https://discourse.gohugo.io/t/how-can-i-redirect-to-an-external-link-on-click-of-header-of-any-blog/9886/3 "2018-01-07T03:47:57Z")

</div>

That’s a matter of editing the template or templates, and depending on your code, it could be any of several places you need to edit to make that work. As @maiki mentions, give us more info on your site/code and we can direct you.

---

<div class="post-metadata">

**Author:** ![agrawalsuneet](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/agrawalsuneet/32/4898_2.png) [@agrawalsuneet](https://discourse.gohugo.io/u/agrawalsuneet)\
**Post date:** [January 7, 2018, 6:24pm UTC](https://discourse.gohugo.io/t/how-can-i-redirect-to-an-external-link-on-click-of-header-of-any-blog/9886/4 "2018-01-07T18:24:16Z")

</div>

I have added multiple posts to post folder which is displayed as a list. I want to redirect to medium pages on click of the header of those post.

 ![28 PM](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/d/d4d3ee126b1b2ba05880360ca776730b0c920efa.png)

In the above screenshot, on click of the header of any blog, I want to redirect to some medium link ([https://medium.com/](https://medium.com/)).

The theme I am using is hugo-geo.

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [January 7, 2018, 11:35pm UTC](https://discourse.gohugo.io/t/how-can-i-redirect-to-an-external-link-on-click-of-header-of-any-blog/9886/5 "2018-01-07T23:35:01Z")

</div>

Instead of `{{ .Permalink }}` you need to put the Medium URL.

> <https://github.com/alexurquhart/hugo-geo/blob/master/layouts/post/summary.html#L4>

You can override the theme by copying its files to the equivalent location in your project.

You could make a key:value in your pages’ frontmatter to hold the Medium URL, and pull that into the template, instead of the page’s permalink.

---

<div class="post-metadata">

**Author:** ![agrawalsuneet](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/agrawalsuneet/32/4898_2.png) [@agrawalsuneet](https://discourse.gohugo.io/u/agrawalsuneet)\
**Post date:** [January 8, 2018, 6:03pm UTC](https://discourse.gohugo.io/t/how-can-i-redirect-to-an-external-link-on-click-of-header-of-any-blog/9886/6 "2018-01-08T18:03:21Z")

</div>

This works.  
I replaced the below line in summary.html

`href="{{ $.Params.affiliatelink }}`

and added

```
affiliatelink = "https://medium.com"

```

in the posts.  
Thank you 🙂
