2024-06-10 09:12:03 发布
网友
我想建立我的个人网页在鹈鹕,但我缺少一个功能。我想有一个介绍页一些/所有类别的页面。在
例如,我想为我的赠款项目建立一个页面,其中的帖子与活动和/或已发表的论文有关,但我也希望有一个单独的页面来说明有关赠款项目的内容,并将此页面作为该类别的标题页。在
在鹈鹕的框架中这是可能的吗?如果没有,你能推荐一个更好的静态页面框架来组合Markdown+Python吗?在
这对鹈鹕来说其实很简单。插件Auto Pages定义了三个额外的内容文件夹:一个用于作者,一个用于类别,一个用于标记。在
假设你,约翰·史密斯,想在点击你的名字时获得关于你的人的额外信息。然后,您将添加一个名为authors/john-smith{.rst|.md}的文件,其中包含这些额外的信息。没有HTML,只有你想提供的关于你的人的内容。这些内容然后被读入、转换并作为author.page呈现给模板引擎。在
authors/john-smith{.rst|.md}
author.page
现在是关于你的模板也使用这个变量。 在我的主题中,我简单地修改了theme/templates/author.html,不显示与我的作者相关的“featured article”和“other articles”的组合,而是显示与我的作者相关的author.page.content和“all articles”。在
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并根据您的需要进行调整。在
index.html
这对鹈鹕来说其实很简单。插件Auto Pages定义了三个额外的内容文件夹:一个用于作者,一个用于类别,一个用于标记。在
假设你,约翰·史密斯,想在点击你的名字时获得关于你的人的额外信息。然后,您将添加一个名为
authors/john-smith{.rst|.md}
的文件,其中包含这些额外的信息。没有HTML,只有你想提供的关于你的人的内容。这些内容然后被读入、转换并作为author.page
呈现给模板引擎。在现在是关于你的模板也使用这个变量。 在我的主题中,我简单地修改了
theme/templates/author.html
,不显示与我的作者相关的“featured article”和“other articles”的组合,而是显示与我的作者相关的author.page.content
和“all articles”。在我的
theme/templates/author.html
的简短摘录:您可以使用上面描述的过程对类别和标记执行完全相同的操作。对于模板,只需使用现有的
index.html
并根据您的需要进行调整。在相关问题 更多 >
编程相关推荐