[英]Add left navigation bar on github pages with .md files
I want to create some documentation for our project in GitHub.我想为 GitHub 中的项目创建一些文档。
I can see, that GitHub already provides these options with GitHub pages.我可以看到,GitHub 已经为 GitHub 页提供了这些选项。 In the intro video, I can see that you can and multiple pages (.md files) and navigation.
在介绍视频中,我可以看到您可以使用多个页面(.md 文件)和导航。
I already add Jekyll.我已经添加了 Jekyll。
But:但:
Right now I have现在我有
-> Root
|
-> _config.yml
-> about.md
-> index.md
-> README.md
-> docs
|
-> first_page.md
-> second_page.md
The config file I have我有的配置文件
title: title
description: YOUR DESCRIPTION
baseurl: 'our_domain'
kramdown:
math_engine: mathjax
syntax_highlighter: rouge
plugins:
- jekyll-default-layout
# Navigation
# List links that should appear in the site sidebar here
navigation:
- text: Documentation
internal: true
url: ./docs
The just the docs theme mentioned by Benjamin includes a sidebar in the default layout using {% include components/sidebar.html %}
This sidebar.html is very interesting but a quite complex example on how to do it, including other files, etc.本杰明提到的文档主题在默认布局中包含一个侧边栏,使用
{% include components/sidebar.html %}
这个sidebar.html非常有趣,但是关于如何做到这一点的一个相当复杂的例子,包括其他文件等。
In short:简而言之:
Very simple example:非常简单的例子:
<nav>
<ul>
{% for item in site.navigation %}
<li>
<a href="{{ item.url }}">{{ item.text }}</a>
</li>
{% endfor %}
</ul>
</nav>
The Jekyll docs include simpler examples on how to loop such files. Jekyll 文档包含有关如何循环此类文件的更简单示例。 The docs also explain how to use a YAML file in the _data folder for this instead.
该文档还解释了如何为此使用 _data 文件夹中的 YAML 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.