0

I'm stuck at the following issue being a new in Hugo. I want to redirect URL to a absolute URL rather than relative url. Here is what I means. In _index.md file

# Display name
title: mohit kumar
url: ranveeriit.github.io/

Assume base URL is https://eample.com. As such, hugo redirects me to https://example.com/ranveeriit.github.io/ what I want hugo to redirect to ranveeriit.github.io/ when I click the mohit kumar under meet the team at https://chandu8542.github.io/. I'm using hugo wowchemy academic theme.

CKM
  • 1,911
  • 2
  • 23
  • 30

1 Answers1

0

You have to edit your theme's /layouts/ files to add support to your particular use-case.

  1. It may be in index.html or list.html or some other file, depending on how your theme split up their code.

  2. Look for the <a href=""> part. It more likely looks like <a href="{{ .Permalink }}"> or <a href="{{ .RelPermalink}}">.

  3. Change it to something like: <a href="{{ with .Params.link }}{{ . }}{{ else }}{{ .Permalink }}{{ end }}">.

  4. Then in your .md file, add the link frontmatter param. It should look similar to this:

---
link: https://example.com
---
  • thanks for the ans. I'm not able to find the file/place to modify. Could you help me out? `_index.md` is available at [link](https://github.com/chandu8542/chandu8542.github.io/tree/master/content/authors/ranveer). Index.html or list.html is not present in layouts. – CKM May 17 '22 at 10:27
  • Hmm… I'm not familiar with your theme, I tried visiting github.com/wowchemy/wowchemy-hugo-modules/wowchemy but Github is returning 404 yet it is in your config file as a module. Without access to the theme's source, it's impossible to help in this case, probably best to contact wowchemy. Regardless, you just have to find which file your theme placed {{ .Permalink }} or {{ .RelPermalink }} and edit it accordingly to support a new Param. Some complicated themes, like I think what wowchemy is, probably have it deep somewhere, you'll have to track down how their theme works to find it. – I'M YourOnly.One May 18 '22 at 10:15