Not every page has to come from the CMS. Pages can also be made static while still being able to get data or glossary. These pages can also support multilingual.
function Search(){
return <h1>This is the static search page</h1>;
}
// Let hydrate know it should not do an API request
Zoeken.static = true;
// Manually add which translations are available
Zoeken.translations = [
{
title: 'Zoeken',
slug: '/nl/zoeken',
language: 'nl',
},
{
title: 'Search',
slug: '/en/search',
language: 'en',
},
];
export default hydrate(Search);
The example can be expanded with sections and GraphQL calls just like every other page.
Note: There will be an automatic redirect if languages are mixed up. If you were to go to
/nl/search
you would get a redirect to/nl/zoeken
instead. The locale will be the leading factor in this redirect.
Last modified | Monday, August 30, 2021, 2:00:02 PM UTC |
Last author | Colin van Eenige |
Commit ID | fd08685 |