zjedi / hugo-scroll

Clean, responsive, single-page Hugo website theme.
https://themes.gohugo.io/hugo-scroll/
MIT License
279 stars 197 forks source link

Multi-language support #119

Open maaque opened 1 year ago

maaque commented 1 year ago

When I add multilanguage support in the config.toml like

[languages] [languages.de] title = "Test Deutsch" weight = 2

[languages.en] title = "Test English" weight = 1

and try to start the hugo server I get the error message: Error: Error building site: "/home/content/impressum.de.md:13:1": failed to extract shortcode: template for shortcode "icon" not found

As soon as I remove the language section is works again. Any idea, what I am doing wrong?

zjedi commented 1 year ago

Hi @maaque, honestly I am not sure this theme supports i18n, I've only used it for single language sites. It can take some time before I get to look at it closer, but it's a good idea.

maaque commented 1 year ago

That would be really appreciated and BTW, many thanks for this great template

spi43984 commented 1 year ago

Any hints how multilanguage support could be implemented?

Probably simplest approach would be like content subfolders /de and /en with the content inside - but how would the top homepage need to look like?

zjedi commented 1 year ago

@spi43984 see https://gohugo.io/functions/i18n/ I think we should stick to Hugo patterns when possible

spi43984 commented 1 year ago

@spi43984 see https://gohugo.io/functions/i18n/ I think we should stick to Hugo patterns when possible

I agree - I could try an help but would need some short instruction how hugo-scroll is set up and where to dig in.

spi43984 commented 1 year ago

With the exampleSite I tried

defaultContentLanguage = "en"
defaultContentLanguageInSubdir = true

[languages]
  [languages.de]
    contentDir = 'content/de'
    disabled = false
    languageCode = 'de-DE'
    languageDirection = 'ltr'
    languageName = 'Deutsch'
    title = 'Projekt Dokumentation'
    weight = 1
    [languages.de.params]
      subtitle = 'Referenz, Tutorials und Erklärungen'
  [languages.en]
    contentDir = 'content/en'
    disabled = false
    languageCode = 'en-US'
    languageDirection = 'ltr'
    languageName = 'English'
    title = 'Project Documentation'
    weight = 2
    [languages.en.params]
      subtitle = 'Reference, Tutorials, and Explanations'

with content/homepage copied into two directories content/de and content/en (that resulted in content/de/homepage and content/en/homepage).

I had to copy layouts/shortcodes into exampleSite/layouts. Then got rid of a similar error to Error: Error building site: "/home/content/impressum.de.md:13:1": failed to extract shortcode: template for shortcode "icon" not found.

A page is not rendered though correctly, see only "Page Not Found" in browser. Need to dig in further.

valsha commented 1 year ago

any luck with Multi-Language support? Thank you.

spi43984 commented 1 year ago

any luck with Multi-Language support? Thank you.

not yet. Still need to work on that. Could need a little support...

zjedi commented 6 months ago

@maaque @valsha @spi43984 multi-language support now being developed in #177, check the PR while the code is hot :)

zjedi commented 5 months ago

Hm, what worked at Netlify doesn't work for Github pages, this will need some more fixing for exampleSite, but the feature is now available.