gpt4 book ai didi

nginx - 在 Ghost 上创建自定义页面

转载 作者:行者123 更新时间:2023-12-04 22:43:27 24 4
gpt4 key购买 nike

我希望将更多 .hbs 文件添加到 ghost/custom/themes/casper,例如关于页面和登录页面。这样,所有文件都使用相同的默认布局,并且我的博客有一个/blog 目的地。

但是,当我创建一个 .hbs 文件,例如 about.hbs,并为其提供与 page.hbs 中相同的代码,并将其上传到主题文件夹时,当我转到 my-url.com/about 时,它给出一个 404。

那么,如何创建自定义 .hbs 页面?

最佳答案

  • 在 Ghost 后端创建具有特定 slug 的页面。
  • 创建 .hbs 文件,名称如下: page-about.hbs

  • 来自 Ghost Documentation on custom pages :

    For example, if you have an 'About' page with the url /about/, adding a template called page-about.hbs will cause that template to be used for the about page, instead of page.hbs, or post.hbs.

    These templates exist in a hierarchy. Ghost looks for a template which matches the slug (page-:slug.hbs) first, then looks for page.hbs and finally uses post.hbs if neither is available.

    关于nginx - 在 Ghost 上创建自定义页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38135326/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com