我想建立我的个人网页在鹈鹕,但我错过了一个功能。我希望有一个介绍性的页面,为一些/所有类别的网页。
例如,我想为我的赠款项目建立一个页面,其中的帖子与活动和/或已发表的论文有关,但是我也想要一个页面来说明赠款项目,并保留这个页面作为这个类别的标题页。
在鹈鹕的框架下,这是可能的(容易)吗?如果没有,您能提出更好的静态页面框架,在组合Markdown+Python中工作吗?
发布于 2016-06-30 07:11:09
其实这对鹈鹕来说很容易。插件自动页面定义了三个额外的内容文件夹:一个用于作者,一个用于类别,另一个用于标记。
说你,约翰·史密斯,当你点击你的名字时,你想了解更多关于你的人的信息。然后,您将添加一个名为authors/john-smith{.rst|.md}的文件,其中包含这些额外信息。没有HTML,但是只有你想提供的关于你的人的内容。然后将这些内容读入、转换并以author.page的形式呈现给模板引擎。
现在,您的模板也应该使用这个变量。在我的主题中,我只是修改了theme/templates/author.html,使其不显示与作者相关的“特色文章”和“其他文章”的组合,而是显示与作者相关的author.page.content和“所有文章”。
我的theme/templates/author.html的简短摘录
<aside id="featured" class="body">
<article>
<h1 class="entry-title"><a href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a></h1>
{{ author.page.content }}
</article>
</aside>
<section id="content" class="body">
<!-- removed the apostrophe for SO highlighting reasons-->
<h1>Authors articles</h1>
<hr/>
<ol id="posts-list" class="hfeed" start="{{ articles_paginator.per_page - 1}}">
{% for article in articles_page.object_list %}
<li><article class="hentry">
<header>
<h1><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark"
title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h1>
</header>
{% include 'article_infos.html' %}
{{ article.summary }}
<a class="readmore" href="{{ SITEURL }}/{{ article.url }}">read more</a>
{% include 'comments.html' %}
</article></li>
{% endfor %}
</ol>
{% if articles_page.has_other_pages() %}
{% include 'pagination.html' %}
{% endif %}
</section>您可以使用上面描述的过程对类别和标记执行完全相同的操作。对于模板,只需使用现有的index.html并使其适应您的需要。
https://stackoverflow.com/questions/37385708
复制相似问题