【问题标题】:Dropdown menu and link to pages in pelican bootstrap theme鹈鹕引导主题中的下拉菜单和页面链接
【发布时间】:2017-04-02 22:12:04
【问题描述】:

我正在使用pelican-bootstrap3 主题,我有一个我自己无法解决的琐碎问题。

我有一些页面,我想做的是为另一个页面的某些页面创建一个下拉菜单。

假设我有这种情况:

├── content
│   ├── pages
│   │   ├── about.md
│   │   ├── courses_list.md
│   │   └── first-corse.md
│   │   └── second-corse.md

我希望主导航栏带有 course-list 可见,fist-coursesecond-course 作为下拉菜单的子菜单。

我正在尝试(没有成功)编辑的html 代码是base.html

        {% if DISPLAY_PAGES_ON_MENU %}
            {% for p in pages | sort(attribute=PAGES_SORT_ATTRIBUTE) %}
                {% if p.url %}
                 <li{% if p == page %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ p.url }}">
                     {{ p.menulabel|default(p.title) }}
                  </a></li>
                {% endif %}
              {% endfor %}
        {% endif %}

有人遇到过类似的问题吗?

谢谢大家!

【问题讨论】:

标签: html css twitter-bootstrap pelican


【解决方案1】:

Pelican 作者does not prefer 分层菜单(作为反模式)在其核心功能中。相反,他们欢迎插件或主题模板在必要时处理此功能。 因此,部署该功能(仅)是您自己的事。

在 github 上有(可能更多)主题处理分层菜单,例如 pelican-chameleon 主题,使用 MENUITEMS 定义,就像这个示例中取自 chameleon 自述文件一样。

# works with chameleon theme
MENUITEMS = [
    ('Home', '/'),
    ('Archives', [
        ('Tags', '/tags.html'),
        ('Categories', '/categories.html'),
        ('Chronological', '/archives.html'),
        ]),
    ('Social', [
        ('Email', 'mailto: xx@yy'),
        ('Github', 'http://url-to-github-page'),
        ('Facebook', 'http://url-to-facebook-page'),
        ]),
    ]

【讨论】:

    猜你喜欢
    • 2014-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-06
    • 1970-01-01
    • 2020-12-26
    相关资源
    最近更新 更多