I like this theme(sphinx-rtd-theme) very much, and github pages natively support jekyll, so I made this theme. A little experience is as follows:
Abandon the traditional date + name
file format, because it is not good-looking and has no structure to speak of, directly use jekyll’s pages form, so that the produced page has a good structure.
There were a few questions at the beginning:
- How to list articles in a specific directory, or even subdirectories, jekyll can list all pages, list files in a specific directory but no solution is found
- Sorting of articles
- Breadcrumb navigation
- pages does not support the previous and next pages
- How to combine git data
- Is the previous setting feasible without writing the article
- The key point is that the liquid language is very weak, or it is not a programming language
After my patient research, I finally got a solution, the idea is as follows:
- When listing a specific directory, you can use slashes to divide the path, calculate the length and value to get the directory, of course the file in the directory is the length plus one, which has been resolved
reset all of the dirs and files
get current workspace dirs and files
- The sorting of the article can be the file name
sort
, but such a file structure is really ugly, so the sorting can be sorted by adding a variable to the front of the page, which has been resolved
---
sort: 1
---
# Theme Documentation
- Breadcrumb navigation also divides the path into blocks, and then accumulates (for).
{%- for block in blocks -%}
{%- if forloop.last %}
<li>{{ page.title }}</li>
{%- else -%}
{%- capture href -%}
{{ site.baseurl }}/{% for block in blocks limit: forloop.index %}{{ block | append: "/" }}{% endfor %}
{%- endcapture %}
<li>
<a href="{{ href }}">{{ block }}</a></i>
</li>
{%- endif -%}
- The prev and next pages of
pages
can also follow the sorted file list, and the for loop gets the index of the current page, then the previous page is subtracted by 1, and the next page is added by 1, which is resolved
- Github pages has the support of the plugin and has been resolved
- Do not write the previous settings of the article, you can also use the plugin supported by github pages to automatically obtain the title of the article markdown as the title, which has been resolved
- Until now, do you still think that liquid language is not good? Hee hee
Welcome to experience this theme I wrote, This article will continue to be updated, Thanks