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

Custom 404 page #5

Closed
aklsh opened this issue Sep 14, 2020 · 2 comments
Closed

Custom 404 page #5

aklsh opened this issue Sep 14, 2020 · 2 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@aklsh
Copy link

aklsh commented Sep 14, 2020

Hey @ejmg ,
I am trying out this theme for my website. One thing I would like to know is creating a 404 page. I tried out what was given in the zola docs, but I get this error:

Error: Failed to render '404.html' (error happened in a parent template)
Reason: Variable `current_path` not found in context while rendering '404.html'

I placed the 404.html file in the templates/ directory, with the following content:

{% extends "index.html" %}

{% block content %}
    <div class="post">
        <h1 class="post-title">404: Page not found</h1>
        Sorry. non-existent
    </div>
{% endblock content %}

Is there anything else I should do? Can you please help?

@ejmg
Copy link
Owner

ejmg commented Sep 14, 2020

Are you extending the theme directly (i.e. modifying the code of the theme itself) or are you trying to use the theme for your blog and adding on to it? These are two different things and might be the issue at hand.

In the case of the latter, all you should have to do is make a 404.html file under templates/, as you seem to be doing. The next thing would be to extend the theme itself before writing your changes. For my own blog, that means I have

{% extends "zerm/templates/index.html" -%}

at the top of my 404 file.

Finally, there is no content block in zerm. There is, however, a main block. Try using that if you want to extend from what zerm has rather than adding entirely new structure on to the theme.

Let me know if that fixes your problem.

@ejmg ejmg added documentation Improvements or additions to documentation question Further information is requested labels Sep 14, 2020
@ejmg
Copy link
Owner

ejmg commented Oct 24, 2020

Hi akish, I haven't heard back from you so I'm going to close this issue.

@ejmg ejmg closed this as completed Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants