如何将自定义模板页面添加到夹层? [英] How to add a custom template page to mezzanine?
问题描述
我已经在夹层玩了几天,我一直在追踪这个博客,这是非常有帮助的。
I've been playing around with mezzanine for a couple days and I've been following this blog, which has been very helpful.
我现在正处于这一点,我需要制作一堆需要基于一个自定义模板。我的自定义模板称为 content.html
I'm now at the point where I need to make a bunch of pages that need to be based off of a custom template. My custom template is called content.html
我把它放在 myProject> ; myApp /主题文件夹>模板>页面> content.html
,但是当我在管理控制台中查看时,我没有在下拉菜单中看到内容。
I've put it in myProject > myApp/theme folder > templates > pages > content.html
but when I look in the admin console, I don't see content in the drop down menu.
如何获得夹层以识别我的 content.html
页面作为模板?
How do I get mezzanine to recognize my content.html
page as a template?
推荐答案
content.html
不会自动显示在您网站的下拉菜单中。
content.html
will not automatically appear in your site's drop down menu.
您需要转到管理员网站,并明确声明一个页面我的内容
您要在哪里 content.html
显示在您的页面层次结构中。
You need to go to the admin site and explicitly declare a page my content
where you would like content.html
to appear in your page hierarchy.
对于夹层来匹配两者(即模板 content.html
和管理页面我的内容
):
For mezzanine to match the two (i.e. template content.html
and admin page my content
):
-
我的内容
标题字段(管理站点)应为内容
, - 或URL字段(元数据部分
我的内容
)应该是内容
(如果你决定标题不会是内容
), -
或者,如果你想要
content.html
有一个自定义的lug子,说nicecontent
,然后用nicecontent
填写URL字段,并添加到url.py
一个模式对于content.html
与匹配的插件,所以:
- Either
my content
's Title field (in admin site) should becontent
, - Or, URL field (in the meta data section of
my content
) should becontent
(if you decide the title will not becontent
), Or, if you want
content.html
to have a custom slug, saynicecontent
, then fill URL field withnicecontent
and add tourl.py
a pattern forcontent.html
with a matching slug, so:
url("^nicecontent/$", direct_to_template, {"template": "path/to/content.html"}, name="name_for_content").
这篇关于如何将自定义模板页面添加到夹层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!