'Absolute url in hugo website front matter _index.md file
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.
Solution 1:[1]
You have to edit your theme's /layouts/
files to add support to your particular use-case.
It may be in
index.html
orlist.html
or some other file, depending on how your theme split up their code.Look for the
<a href="">
part. It more likely looks like<a href="{{ .Permalink }}">
or<a href="{{ .RelPermalink}}">
.Change it to something like:
<a href="{{ with .Params.link }}{{ . }}{{ else }}{{ .Permalink }}{{ end }}">
.Then in your
.md
file, add thelink
frontmatter param. It should look similar to this:
---
link: https://example.com
---
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | I'M YourOnly.One |