Is there a way to either disable redirect pages (like /tags/tagname/page/1/index.html) or add my own template for Hugo to override what it outputs?
I am in the process to configure an HTML validator and receive lots of errors to these pages, while at the same time doing redirects via headers, so the files created are not being used on the server and the errors are irrelevant (mostly about language attributes).
You will say “just ignore those files”, but I fail to have an idea how to configure what files to ignore. They are all index.html files which doesn’t help indicate which files to ignore.
I could probably “just” search for all files that have a <meta http-equiv="refresh"
in them. Just asking before I go that route It might be just some milli seconds that I loose.
On a side note, those redirect files have one single function, to tell the browser to redirect via a special meta tag that indicates a header, here is a sample content:
<!DOCTYPE html>
<html>
<head>
<title>http://192.168.1.201:1313/tags/web-development/</title>
<link rel="canonical" href="http://192.168.1.201:1313/tags/web-development/"/>
<meta name="robots" content="noindex">
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0; url=http://192.168.1.201:1313/tags/web-development/" />
</head>
</html>
the following parts could be removed to shave off some more bits without making the html invalid:
- the title tag (unnecessary)
- the link-rel-canonical tag (not used because it’s a redirect and google is not interested in listing this page)
- the meta-robots tag (not used because it’s a redirect and google is not interested in listing this page)
- the meta-charset tag (indicating the content encoding of the file, which is a redirect, which results in the file not being shown in the browser. so not used for anything.)
- the slash at the end of the meta-http-equiv tag (unnecessary within HTML5)
PS: for what it’s worth, the bash line to delete all files with refresh-redirects is this one:
grep -lrIZ http\-equiv\=\"refresh public | xargs -0 rm -f --