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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow single-language pages #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ranbena
Copy link

@ranbena ranbena commented Jan 23, 2021

This is a PR to allow single-language pages.

The problem:
My site's intl is defined with 2 languages but a some pages are only in one language (for instance a page for a conference offered for English speakers only, therefore irrelevant to translate to additional locales).

But there is no way to indicate to the plugin that a certain page should "opt out" of all language page generation.

The solution:
Defining a page in a directory with the language name is easy and clear.
Here's an example:

// languages - en + es
|-- /src
    |-- /pages
        |-- foo.jsx      <-- normal: generates /foo, /en/foo, /es/foo
        |-- a/bar.jsx    <-- normal: generates /a/bar, /a/en/bar, a/es/bar
        |-- en/baz.jsx   <-- single language: generates en/baz only 馃敟

Related to #152.

@ranbena
Copy link
Author

ranbena commented Jan 23, 2021

Notice, I'm already using this in production on a website of mine called citytree.

This is my pages folder.
You can see practical-ecology has both English and Hebrew.
While abracadabra is only in English (Hebrew yields 404 page).

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

Successfully merging this pull request may close these issues.

None yet

1 participant