2

我在 Nikola 网站上工作,并希望在标签模板以外的模板中显示标签。我想知道是否有没有附加组件的方法可以访问items变量中的标签列表。

## -*- coding: utf-8 -*-
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="pheader" file="post_header.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%namespace name="math" file="math_helper.tmpl"/>
<%inherit file="post.tmpl"/>

<%block name="content">
<div class="wordview-header">
  <h1> ${post.title()} </h1>
</div>

${post.text()}

<!-- here I have copied from a tags template the section that generates tags -->
% if items:
<h1>Topics</h1>
    <ul class="list-inline">
    % for text, link in items:
        % if text not in hidden_tags:
            <li><a class="reference badge" href="${link}">${text}</a></li>
        % endif
    % endfor
    </ul>
    % endif

${math.math_scripts_ifpost(post)}
</%block>

我在想有一种方法可以在设置中更改它以将item变量添加到其他模板文件,而不仅仅是标签。

4

0 回答 0