404游戏html,404.html Templates

When using Hugo with GitHub Pages, you can provide

your own template for a custom 404 error page

by creating a 404.html template file in your /layouts folder.

When Hugo generates your site, the 404.html file will be placed in the root.

404 pages are of the type “node” and have all the node

variables available to use in the templates.

In addition to the standard node variables, the 404 page has access to

all site content accessible from .Data.Pages.

▾ layouts/

404.html

404.html

This is a basic example of a 404.html template:

{{ partial "header.html" . }}

{{ partial "subheader.html" . }}

{{ .Title }}

{{ partial "footer.html" . }}

Automatic Loading

Your 404.html file can be set to load automatically when a visitor enters a mistaken URL path, dependent upon the web serving environment you are using. For example:

GitHub Pages - it’s automatic.

Apache - one way is to specify ErrorDocument 404 /404.html in an .htaccess file in the root of your site.

Nginx - you might specify error_page 404 = /404.html; in your nginx.conf file.

Amazon AWS S3 - when setting a bucket up for static web serving, you can specify the error file.

Caddy Server - using errors { 404 /404.html }. Details here

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值