致命错误,而不是404页


Fatal error instead of 404 page

我遵循了文档中关于制作资源内容类型并将其用于404页面的指南,但我看到的不是页面,而是以下致命错误:

Class: Symfony'Component'HttpKernel'Exception'HttpException
Message: The page could not be found, and there is no 'notfound' set in 'config.yml'. Sorry about that.
Code: 0

这很奇怪,因为在config.yml中找不到被设置为:

notfound: resources/not-found

知道可能是什么吗?这是内容类型:

resources:
name: Resources
singular_name: Resource
fields:
    title:
        type: text
        class: large
        required: true
    slug:
        type: slug
        uses: title
    html:
        type: textarea
        height: 150px
default_status: published
record_template: resource.twig
searchable: false
viewless: true

和资源。假发:

{{ record.title }}

我创建的404资源的唯一别名是/resources/not found

确保资源记录已"发布"。

……如果我每次亲自动手都有1美元,那就是假期了。

资源内容类型不是合适的工具。最好用slug not-found发布一个站点,并在配置中进行设置。

代码不起作用的原因:您已经在资源内容类型上设置了viewless: true,这意味着在前端没有它的路由。