statamic / ssg

The official Statamic Static Site Generator
229 stars 23 forks source link

Should generate multi-site error pages #73

Open tao opened 2 years ago

tao commented 2 years ago

On my Statamic site I have error pages that are localised automatically depending on the language:

/404.html (English)
/fr/404.html (French)

When SSG runs it generates the 404.html pages but not error pages for each multi-site. Now, depending on the host for the static website it might be a bit difficult to route errors to /fr/404.html unless you do some custom handling.. but it is possible with Lambda for example if you have that set up.

So it would be nice for SSG to generate them anyway for us, or the docs should mention that as an edge-case so we can add our own urls to generate them in AppServiceProvider.php if we are building a more complex multi-site.

jasonvarga commented 2 years ago

It should do this. Just didn't think about multisite situation when building the feature 👍

tao commented 2 years ago

Yeah. I use the same error template across the entire site, and use {{ trans }} tag to show the error warning depending on the current language, it's quite simple:

<div class="content text-center">
    <h1>404</h1>
    <p>{{ trans key="lang.error_404" site="{locale}" }}</p>
</div>

However, it's a nice little extra that improves the experience if someone from a foreign language finds a bad link, and would be a nice touch to add to SSG when you get a chance. However, not the end of the world to add the links ourselves.