~sircmpwn/sr.ht-discuss

3 3

pages.sr.ht Allow users to make a custom 404 page

Details
Message ID
<YxpIpVAH5z37SGSS@Cybertank>
DKIM signature
missing
Download raw message
Hey,

I have a source hut page (https://e-topy.srht.site) and I've made a custom 404 page a while back,
however visiting an invalid URL (e.g. https://e-topy.srht.site/asd) doesn't redirect
to the 404 page (https://e-topy.srht.site/404.html).
I was wondering if it could be possible to specify a 404 page, and add it to the documentation if it exists.

Thanks,
Topy.
Details
Message ID
<CMRBF8JOUN9S.3F7A4Z45J1HS@butia>
In-Reply-To
<YxpIpVAH5z37SGSS@Cybertank> (view parent)
DKIM signature
missing
Download raw message
Hey Topy!

On Thu Sep 8, 2022 at 4:55 PM -03, E-Topy wrote:
> I was wondering if it could be possible to specify a 404 page, and add
> it to the documentation if it exists.

Yes you can, I think you should use the GraphQL API to do that, as you
can see on the Site Entity: 

> "A published website"
> type Site {
> id: Int!
> created: Time!
>
> (... Trimmed for obvious reasons ...)
> 
> "Path to the file to serve for 404 Not Found responses"
> notFound: String

I'm pretty sure if you browse the archives you'll see some other tips or
discussion on the matter. If you use hut on your deployment process you
can use the flag --not-found which you can read more at the hut man page
(man hut) or here:
https://git.sr.ht/~emersion/hut/tree/master/item/doc/hut.1.scd#L456)

Cheers,
Pedro Lucas Porcellis
Details
Message ID
<ca9e4dda-0066-5e96-fed4-1b0b26af8798@bitfehler.net>
In-Reply-To
<YxpIpVAH5z37SGSS@Cybertank> (view parent)
DKIM signature
missing
Download raw message
Hi,

On 9/8/22 21:55, E-Topy wrote:
> I was wondering if it could be possible to specify a 404 page, and
> add it to the documentation if it exists.
If you use hut to publish your site (like e.g. described here: [1]), you 
can specify a 404 page by adding e.g. `--not-found /404.html` to the 
command. See also `hut pages publish -h`.

Hope that helps,
Conrad

[1]: https://srht.site/automating-deployments
Details
Message ID
<YxsWPNam9GG/kfYj@Cybertank>
In-Reply-To
<ca9e4dda-0066-5e96-fed4-1b0b26af8798@bitfehler.net> (view parent)
DKIM signature
missing
Download raw message

      
Reply to thread Export thread (mbox)