lumeland / lume.land

The website of lume.land
https://lume.land
MIT License
68 stars 65 forks source link

doc: link to a page by lang #123

Closed benjamingeets closed 2 months ago

benjamingeets commented 2 months ago

Hi 👋,

I've been using the multilanguage today and found this way to link to a page in the current language:

{{ set about = search.page('about lang=' + lang) }}

<a href="{{ about.url }}">About</a> <!-- This will always output the URL translated in the current lang -->

Thinks it would be nice to add in the doc. (+ a small information about the translated data only working at page level).

Thank you!

netlify[bot] commented 2 months ago

Deploy Preview for lumeland ready!

Name Link
Latest commit 5e7d737f43517ed1f9d7fbdcd58d8f85ff2a5bb2
Latest deploy log https://app.netlify.com/sites/lumeland/deploys/663620ed4c73770008100a76
Deploy Preview https://deploy-preview-123--lumeland.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

oscarotero commented 2 months ago

Thanks!

It's possible to use tags for this, but maybe it's more correct to use the id field, because it's used by multilanguage plugin to identify whether two pages have the same content in different languages.

So I'd recommend something like this:

{{ set about = search.page('id=about lang=' + lang) }}
benjamingeets commented 2 months ago

That's even better!

benjamingeets commented 2 months ago

Oh, sorry, I didn't pay much attention 😅

oscarotero commented 2 months ago

Thank you!