It has been 1485 days since the last update, the content of the article may be outdated.

依然是初期的一些乱七八糟倒腾系列。不过让我接触了Git,Markdown,静态页面,部署,等等。

Default sidebar options

According to the metadata in your articles,sidebar shows:
sidebar.old

sidebar.old

1. You can activate Pushlish date, Modification date, Category, Tags functions by specify optional meta data variables Date, Modified, Category and Tags when editing your articles.

2. Social links is set in your ‘pelicanconfig.py’, just add your links to the Dictionary

python
# Social widget
SOCIAL = (('GitHub', 'https://....'),
('YouTube', 'https://....'),
('Instagram', 'https://....'),
('Twitter', 'https://....'),
('FaceBook', 'https://....'),)

3. To set your Mailchimp subscribe box, just refer to article Mailchimp subscribe.


Add more options

You can do some modification to the elagant themes source code to show more informations on your right sidebar.
Let’s what can we get:

“Author”

Remember that we have specified author meta in our articles, but elegant theme does not support showing this on sidebar.
step 1. Add author.html under path pelican-elegant/templates/_includes/, don’t worry about the source code of this file, your can copy _includes/last_updated.html and make some modifications:
Details of these two files:

author.html :

html
<!--  modified by Jiheng Hu -->
{% if article.author %}
<h4>Edited By</h4>
<div class="author">{{ article.author }}</div>
{% endif %}

last_updated.html

html
{#  Check which version of Pelican user is using.
If it is <=3.3 than modified is a string
If it is >3.3 than modified is a datetime object
#}
{% if article.locale_modified and article.modified %}

<h4>Last Updated</h4>
{% set day = article.modified.strftime('%d')|int %}
<time datetime="{{ article.modified.isoformat() }}">{{ article.modified.strftime('%b') }} {{ day }} {{- article.modified.strftime(', %Y') }}</time>

{% elif article.modified %}
<h4>Last Updated</h4>
<div class="last-updated">{{ article.modified }}</div>

{% endif %}

step 2. Modify pelican-elegant/templates/article.html
Find the following parts:

html
{% include '_includes/last_updated.html' %}

Add the following line to after it:

html
{% include '_includes/author.html' %}  <!-- added by Jiheng Hu	so is file "_include/author.html"  --> 

step 3. Add author as a meta in your articles and update your blog, you can see the author is attached to to sidebar.


“multi_parts” plugin

The elegant theme support Multi-parts plugin to label posts as parts of a series, the series list is located on sidebar。
You can add ‘multi-parts’ to PLUGINS list in pelicanconfig.py:

python
PLUGINS = [u"neighbors",u"related_posts","tag_cloud","share_post","sitemap","extract_toc","multi_part"]

Add in your markdown articles of the same serie:

markdown
parts:  Serie name

You can see a list on sidebar.

See also multi_part.

multip

multip


“series” plugin

The series plugin is a substitution of multi_part, the reasons we choose the formal one are that:
1. Expand PLUGINS with 'multi_part' will bring in a warning:

plaintext
WARNING: multi_part plugin: this plugin has been deprecated.
| The 'series' plugin provides better support for multi part articles.

2. We can specify the part index for each parts and series will list them in the order of indices, while multi_part can not make it.

However, elegant do not support series plugin, we need to modify 'pelican-elegant/templates/article.html' again.

step 1. Add a author.html under path pelican-elegant/templates/_includes/, the souce code comes from Github.

html
{% if article.series %}
<p>This post is part {{ article.series.index }} of the "{{ article.series.name }}" series:</p>
<ol class="parts">
{% for part_article in article.series.all %}
<li {% if part_article == article %}class="active"{% endif %}>
<a href='{{ SITEURL }}/{{ part_article.url }}'>{{ part_article.title }}</a>
</li>
{% endfor %}
</ol>
{% endif %}

step 2. Add a if conditional clauses to multi_part in 'pelican-elegant/templates/article.html'.

html
{% if 'multi_part' in PLUGINS %}      <!-- added by Jiheng Hu	 -->
{% include '_includes/multi_parts.html' %} <!-- origin code -->
{% endif %} <!-- added by Jiheng Hu -->

step 3. Add following after step 2 code, also with a if conditional clauses.
html
{% if 'series' in PLUGINS %}           <!-- added by Jiheng Hu   -->
{% include '_includes/series.html' %} <!-- added by Jiheng Hu, so is file "_include/series.html" -->
{% endif %} <!-- added by Jiheng Hu -->
```
***step 4.*** Expand `PLUGINS` list with `'series'`, meantime, remove `'multi-parts'` for the list, otherwise you will get two series list on sidebar.
```python
PLUGINS = [u"neighbors",u"related_posts","tag_cloud","share_post","sitemap","extract_toc","series"]#,"multi_part"]

step 5. Use meta data in your articles.
markdown
series: series name
series_index: 1

See also series.

The effect of above setting
sidebar

sidebar

Tip: you can customize the order of sidebar elements by adjusting their quote orders in article.html.