Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: support custom domains #953

Open
maiani opened this issue Jun 27, 2024 · 1 comment
Open

Feature Request: support custom domains #953

maiani opened this issue Jun 27, 2024 · 1 comment

Comments

@maiani
Copy link
Contributor

maiani commented Jun 27, 2024

I have tried to set up a custom domain for a personal GitHub page. It works smoothly but I noticed some SEO problems because of the duplicate content at username.github.io and customdomain.com

The internet suggests the following solution:
add to the head

<meta http-equiv="refresh" content="0; URL=https://customdomain.com/">
<link rel="canonical" href="https://customdomain.com/">

I considered modifying just my fork of the theme, but I am now wondering if there are other places where
the custom domain should be added.

It is also unclear why there are two different parameters for the site URL: baseURL in hugo.yaml and openGraph.url.
Is there any case where they should differ from each other?

Since this may be a common situation, adding an option to the theme to support custom domains may be worth adding.

@BernatBC
Copy link
Member

BernatBC commented Sep 6, 2024

Hi @maiani, sorry for the late response.
I also have a custom domain, and I don't have any problems. I just added my custom domain into hugo.yaml, and followed the guide on github pages.

However, if you really wanted to add the html metadata, you can create a file into your site's layout/partials/header.html, paste the content of this file: https://github.com/hugo-toha/toha/blob/main/layouts/partials/header.html, and add your lines there.

Hope this solves the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants