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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 page that inherits base.html #492

Closed
lucassmagal opened this issue Aug 30, 2012 · 10 comments
Closed

404 page that inherits base.html #492

lucassmagal opened this issue Aug 30, 2012 · 10 comments

Comments

@lucassmagal
Copy link

Hello,

I need create a custom 404 page that inherits base.html. How can I do it?

@justinmayer
Copy link
Member

This is alluded to in the docs about pages. Create a page just like any other page (e.g., "About") but with status of "hidden".

(By the way, feel free to ask questions like this via the IRC web chat.)

Perhaps we should include an error page in the default templates that ship with Pelican. Anyone have an opinion on that idea?

@lucassmagal
Copy link
Author

Great, but how can I set this page to be loaded on every 404 status?

@onlyhavecans
Copy link
Contributor

Yes! Sorry I thought I made that clear in the docs.
(I think adding a base template to the quickstart would be useful IMO)

@lucassmagal Since Pelican is all static content you will need to set this in your nginx/apache/lighthttpd config.
For example, in my nginx site I use this

    error_page 500 502 503 504 /50x.html;
    error_page 404 /404.html;

If you want to see an example on how I set up error pages in pelican check my blog's source https://github.com/tbunnyman/BunnyMan.info

@lucassmagal
Copy link
Author

Ok, that's clear now. I'm using Rack::TryStatic in Heroku, but now I know how to solve it. Thank you!

@shrayasr
Copy link
Contributor

shrayasr commented Jan 8, 2015

@justinmayer FWIW I think adding a 404 page in the default templates that ship with pelican would be great as it gives an idea of how these things can be achieved.

@justinmayer
Copy link
Member

A 404 page usually doesn't have different layout than any other page (only the content is different), so I'm not sure that it would need its own template. If anything, it should probably be done as a page that is created during the quick-start process. But that still leaves open the question of how to configure this at the web server level, which makes me wonder whether we should be doing this at all.

@shrayasr
Copy link
Contributor

shrayasr commented Jan 9, 2015

A 404 page usually doesn't have different layout than any other page (only the content is different), so I'm not sure that it would need its own template.

This is true. But that information is missing IMO

it should probably be done as a page that is created during the quick-start process.

A question saying "Create custom 404 page? [y/N]" might work?

But that still leaves open the question of how to configure this at the web server level,

Configuring this at the web server level is beyond the scope of pelican as such. So we shouldn't bother about that part, no?

which makes me wonder whether we should be doing this at all.

One more thing we can do instead of this is to add a quick Tip in the Tips area of the docs? That might help.

@justinmayer
Copy link
Member

Agreed. Anyone want to submit a PR adding the relevant instructions to the Tips page?

shrayasr added a commit to shrayasr/pelican that referenced this issue Jan 9, 2015
@shrayasr
Copy link
Contributor

shrayasr commented Jan 9, 2015

@justinmayer took a crack at it. Do check it out and give feedback.

Thanks

@justinmayer
Copy link
Member

Added to docs via cff5f3e and 38c307e.

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

No branches or pull requests

4 participants