1

I've come across an issue where typing the URL e.g www.sitename.com///about will still load the about template, but not fill the page with the content. Is this an issue for google finding the appropriate pages in google searches? And how can I get these pages to no longer exist or result in a redirect to the correct URL www.sitename.com/about?

Thanks for any assistance

1 Answer 1

1

Are you getting the About template or the layout template it extends?

In a test with a local site I have running, I was able to trigger a 404 for any bad requests by putting

{%  redirect 404 %}

inside the main block in the _layout template.

This works in my case because that block is overridden on every request. If it's not, something has gone wrong and I need to exit out since the layout template should never render on its own.

1
  • I added {% if not entry | length %} as a conditional on the redirect and placed that in the _layout template. That worked a treat!
    – Emmanuel
    Commented Apr 3, 2018 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.