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

multilingual: Add option to keep the main language on top level #2312

Closed
bep opened this issue Jul 29, 2016 · 8 comments
Closed

multilingual: Add option to keep the main language on top level #2312

bep opened this issue Jul 29, 2016 · 8 comments

Comments

@bep
Copy link
Member

bep commented Jul 29, 2016

See #2309

I'll add this here for discussion

I'll take two of my Hugo sites as an example:

http://bepsays.com/ => Norwegian
http://bep.is/ => English

bepsays.com has some English content, so I would love to have a http://bepsays.com/en/, but I would still like my old URLs (the main content) to live as before.

bep.is has a short presentational text in English. It would be cool to point to translations in French, Japanese etc., but I would still like the main language to stay where it is.

  • This complicates things a little, it somewhat put restrictions on section namings etc., but I think it is worth it.
  • It should be optional, but probably default on

/cc

@abourget
@spf13
@RickCogley
@the1900 I

@bep bep self-assigned this Jul 29, 2016
@abourget
Copy link
Contributor

You mean you'd like to render the English homepage at the complete root ?

I use a quick redirection based on browser settings with a hard coded
fallback. Have you seen that ?

GolangMontreal.org/index.html

Le ven. 29 juil. 2016 02:15, Bjørn Erik Pedersen notifications@github.com
a écrit :

See #2309 #2309

I'll add this here for discussion

I'll take two of my Hugo sites as an example:

http://bepsays.com/ => Norwegian
http://bep.is/ => English

bepsays.com have some English content, so I would love to have a
http://bepsays.com/en/, but I would still like my old URLs (the main
content) to live as before.

bep.is has a short presentational text in English. It would be cool to
point to translations in French, Japanese etc., but I would still like the
main language to stay where it is.

  • This complicates things a little, it somewhat put restrictions on
    section namings etc., but I think it is worth it.
  • It should be optional, but probably default on

/cc

@abourget https://github.com/abourget
@spf13 https://github.com/spf13
@RickCogley https://github.com/RickCogley
@the1900 https://github.com/the1900 I


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2312, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAFs8KiMiHsiWbNVSXY3FBcv90wbErE-ks5qaZp0gaJpZM4JX58v
.

@bep
Copy link
Member Author

bep commented Jul 29, 2016

You mean you'd like to render the English homepage at the complete root ? I use a quick

Yes.

redirection based on browser settings with a hard coded fallback. Have you seen that ?

Yes, and that is the good an natural solution for the "full multilanguage" sites. But that does not fit some of my use cases, for SEO reasons etc. (I don't want to move 90% of my URLs one level down), I don't want my "main page" be a redirect etc.

@abourget
Copy link
Contributor

OK this shouldn't be very difficult.. as the addition of prefixes happens
only in a few places. We don't have anything to detect collisions though..
but I would be comfortable not having any.. assuming people don't name
their posts "en" or such.

Le ven. 29 juil. 2016 10:12, Bjørn Erik Pedersen notifications@github.com
a écrit :

You mean you'd like to render the English homepage at the complete root ?
I use a quick

Yes.

redirection based on browser settings with a hard coded fallback. Have you
seen that ?

Yes, and that is the good an natural solution for the "full multilanguage"
sites. But that does not fit some of my use cases, for SEO reasons etc. (I
don't want to move 90% of my URLs one level down), I don't want my "main
page" be a redirect etc.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2312 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAFs8OBlE4oJqzbebyZUeJWEcAKcPWZ5ks5qagpXgaJpZM4JX58v
.

bep added a commit that referenced this issue Aug 4, 2016
@bep
Copy link
Member Author

bep commented Aug 4, 2016

Things to keep in mind when implementing:

  • sitemap.xml

bep added a commit that referenced this issue Aug 5, 2016
bep added a commit that referenced this issue Aug 5, 2016
This commit also unexports some Site methods, making it clear what the external build API really is.

See #2312
@abourget
Copy link
Contributor

abourget commented Aug 7, 2016

What I did (if I didn't document it, I should), is I wrote a static sitemap.xml in my static/ dir like:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>https://blog.abourget.net/en/sitemap.xml</loc>
   </sitemap>
   <sitemap>
      <loc>https://blog.abourget.net/fr/sitemap.xml</loc>
   </sitemap>
</sitemapindex>

@bep bep mentioned this issue Aug 8, 2016
27 tasks
bep added a commit that referenced this issue Aug 8, 2016
bep added a commit that referenced this issue Aug 8, 2016
bep added a commit that referenced this issue Aug 8, 2016
This commit also unexports some Site methods, making it clear what the external build API really is.

See #2312
bep added a commit that referenced this issue Aug 8, 2016
bep added a commit that referenced this issue Aug 9, 2016
bep added a commit that referenced this issue Aug 13, 2016
bep added a commit that referenced this issue Aug 13, 2016
bep added a commit that referenced this issue Aug 13, 2016
This commit also unexports some Site methods, making it clear what the external build API really is.

See #2312
bep added a commit that referenced this issue Aug 13, 2016
bep added a commit that referenced this issue Aug 13, 2016
bep added a commit that referenced this issue Aug 15, 2016
bep added a commit that referenced this issue Aug 15, 2016
bep added a commit that referenced this issue Aug 15, 2016
This commit also unexports some Site methods, making it clear what the external build API really is.

See #2312
bep added a commit that referenced this issue Aug 15, 2016
bep added a commit that referenced this issue Aug 15, 2016
bep added a commit that referenced this issue Aug 20, 2016
bep added a commit that referenced this issue Aug 20, 2016
bep added a commit that referenced this issue Aug 20, 2016
This commit also unexports some Site methods, making it clear what the external build API really is.

See #2312
bep added a commit that referenced this issue Aug 20, 2016
bep added a commit that referenced this issue Aug 20, 2016
bep added a commit that referenced this issue Aug 20, 2016
bep added a commit that referenced this issue Aug 20, 2016
bep added a commit that referenced this issue Aug 20, 2016
This commit also unexports some Site methods, making it clear what the external build API really is.

See #2312
bep added a commit that referenced this issue Aug 20, 2016
bep added a commit that referenced this issue Aug 20, 2016
bep added a commit that referenced this issue Sep 6, 2016
bep added a commit that referenced this issue Sep 6, 2016
bep added a commit that referenced this issue Sep 6, 2016
This commit also unexports some Site methods, making it clear what the external build API really is.

See #2312
@bep bep closed this as completed in 8da0403 Sep 6, 2016
bep added a commit that referenced this issue Sep 6, 2016
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
This commit also unexports some Site methods, making it clear what the external build API really is.

See gohugoio#2312
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
@reuixiy
Copy link

reuixiy commented Jul 8, 2019

@bep Hi there, I got a problem when I test Hugo Multilingual Mode for my unfinished Hugo theme, and I Google here...

Briefly, Hugo generated a useless folder zh in public directory, which includes index.html(a redirect file, use http-equiv="refresh" to redirect to home(/), same as Hugo Aliases) and sitemap.xml two files.

My config.toml:

defaultContentLanguage = "zh"
defaultContentLanguageInSubdir = false

[languages]
  [languages.zh]
    languageName = "中文"
    contentDir = "content/zh"
    weight = 0
    languageCode = "zh-CN"
    hasCJKLanguage= true
  [languages.en]
    languageName = "English"
    contentDir = "content/en"
    weight = 1
    languageCode = "en-US"

What’s more, this folder still could not be removed after I’v tried some tricks, such as:

  1. set disableAliases = true in config.toml
  2. add content/zh/zh/_index.md and add outputs: [] to its front matter

Although this folder has no side effects and I can delete it by myself or bash script, it would be great if Hugo won’t generate it at all or give an option to config it.

Thx.

@reuixiy
Copy link

reuixiy commented Jul 10, 2019

Oh I see… It’s not useless… The /sitemap.xml is just a link to the /zh/sitemap.xml and the /en/sitemap.xml… In multilingual mode, it has to be like this… Because there can only be one file with the same name in the same folder…

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants