Subdomain pages?

hello. i would like to manage someurl.com, blog.someurl.com and tips.someurl.com with hugo. can i do that with one hugo project, or do i have to have three separate projects?

I think you’ll need three separate sites. Hugo assumes such.

However, you can build a theme that is shared by all three.

Is this still the case in 2017.
I have the same requirement and want to avoid creating a separate hugo site for each subdomain.

Help appreciated.

Here again someone with the same question, a year later. Is it still the case that Hugo does not deal with subdomain.domain.com and domain.com at the same time?

Thank you.

It doesn’t make sense that Hugo deal with that.

Technically, those are 3 different domains. You may choose to generate the same site for each of those subdomains, but they will need to be deployed separately.

OK then. I will see how I merge them.

Your use case is not clear. What do you mean by merging?

  • If you want two subdomains to show the exact same content, you would use redirects on your server (nothing to do with Hugo).
  • If you want different content on two subdomains, but have the feel that both are part of the same site, just extract your layouts into a separate Hugo theme, and use the same theme for both sites. You just need to deploy them separately.

I would like subdomain.domain.com to be a mirror of domain.com/subdomain.

In other blogs: blog.domain.com being like domain.com/post/

Maybe is there a way in which I can play with aliases, but probably involves having to force subdomain.domain.com act like a mirror or some sort of solution of domain.com.

Would you think that this would work?

Thank you very much in any case.

I believe you would use 200 redirects for those. I implement those easily on Netlify.

Example: With this redirect rule:

/test/* https://ox-hugo-tests.netlify.com/:splat 200!

You should be able to do something similar on any server.

1 Like

Excellent advice @kaushalmodi. Thank you very much. I will try to implement it and will let you know. My idea is to migrate everything that is under subdomain.domain.com (currently WP) into proper hugo and have a single simple setup. Step by step.

Next time, open with what you are doing. When you move a site from one domain to another (your use case), you set up redirects. Folks don’t actually “mirror” sites unless they are doing so for redundancy. Most folks building websites avoid mirroring, as it makes the search engine game harder to play. :slight_smile: