Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge for multiple PRs #55

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ Extra google plus options (default values are shown):
- ``GOOGLE_PLUS_ONE``: ``False`` show +1 button
- ``GOOGLE_PLUS_HIDDEN``: ``False`` hide the google plus sidebar link.

By default, comments are enabled for all articles and disabled for pages.
To enable comments for a page, add ``Comments: on`` in page meta.
To disable comments for an article, add ``Comments: off`` in article meta.

Google Analytics
-------------

Expand Down Expand Up @@ -94,6 +98,31 @@ FeedBurner integration
you've set the ``FEED_RSS`` or ``FEED_ATOM`` variables. This way, you can arbitrarily set your generated feed URL while
presenting your FeedBurner URL to your users.

Neighbor Articles
-------------------

- ``SHOW_ARTICLE_NEIGHBORS``: set this to ``True`` to show "Previous Post" and "Next Post" bellow article content in the article pages.
``neighbors`` plugin is required for this feature.

Disqus
--------

- ``SHOW_DISQUS_COMMENT_COUNT``: set this to ``True`` to show disqus comments count in article meta paragraph.

Controlling Asides
-------------------

- ``ARTICLE_ASIDES``: a list of asides names, controls which asides and order to be displayed on articles.
If not set, all available asides will be shown.
- ``PAGE_ASIDES``: just like above, but for pages.
- ``INDEX_ASIDES``: just like above, but for the index page.

Individual settings for article or page is available. Just add an ``asides`` in the corresponding article or page meta,
the value is a list of asides names, separated by commas.

Check ``templates/_includes/asides/`` to get the list of available asides, the asides name does not contain ``.html``.
Example setting: ``ARTICLE_ASIDES = ['recentpost', 'categories', 'tags', 'recentcomment', 'github']``.

Contribute
----------

Expand Down
7 changes: 6 additions & 1 deletion templates/_includes/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ <h1 class="entry-title">
{% else %}
<h1 class="entry-title">{{ article.title|striptags }}</h1>
{% endif %}
<p class="meta">{% include '_includes/article_time.html' %}</p>
<p class="meta">
{% include '_includes/article_time.html' %}
{% if SHOW_DISQUS_COMMENT_COUNT %}
{% if DISQUS_SITENAME %} | <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread">Comments</a>{% endif %}
{% endif %}
</p>
</header>

{% if index %}
Expand Down
10 changes: 10 additions & 0 deletions templates/_includes/article_neighbors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% if SHOW_ARTICLE_NEIGHBORS %}
<p class="meta">
{% if article.prev_article %}
<a class="basic-alignment left" href="{{ SITEURL }}/{{ article.prev_article.url }}" title="Previous Post: {{ article.prev_article.title}}">&laquo; {{ article.prev_article.title }}</a>
{% endif %}
{% if article.next_article %}
<a class="basic-alignment right" href="{{ SITEURL }}/{{ article.next_article.url }}" title="Next Post: {{ article.next_article.title}}">{{ article.next_article.title }} &raquo;</a>
{% endif %}
</p>
{% endif %}
11 changes: 11 additions & 0 deletions templates/_includes/asides/categories.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% if categories %}
<section>

<h1>Categories</h1>
<ul id="recent_posts">
{% for category, articles in categories %}
<li><a href="{{ SITEURL }}/{{ category.url }}">{{ category }}</a></li>
{% endfor %}
</ul>
</section>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ <h1>GitHub Repos</h1>
</script>
<script src="{{ SITEURL }}/theme/js/github.js" type="text/javascript"> </script>
</section>
{% endif %}
{% endif %}
5 changes: 5 additions & 0 deletions templates/_includes/asides/image.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% if SIDEBAR_IMAGE %}
<section>
<img src="{{ SITEURL }}/{{ SIDEBAR_IMAGE }}" alt="{{ SIDEBAR_IMAGE_ALT}}" width="{{SIDEBAR_IMAGE_WIDTH}}"/>
</section>
{% endif %}
File renamed without changes.
10 changes: 10 additions & 0 deletions templates/_includes/asides/recentpost.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
{% for article in articles[:5] %}
<li class="post">
<a href="{{ SITEURL }}/{{ article.url }}">{{ article.title|striptags }}</a>
</li>
{% endfor %}
</ul>
</section>
File renamed without changes.
6 changes: 6 additions & 0 deletions templates/_includes/asides/tags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<section>
<h1>Tags</h1>
{% for tag, article in tags %}
<a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>{% if not loop.last %},{% endif %}
{% endfor %}
</section>
5 changes: 5 additions & 0 deletions templates/_includes/disqus_script.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@
dsq.src = "//" + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = "//" + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
{% endif %}
64 changes: 26 additions & 38 deletions templates/_includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
<aside class="sidebar">
{% if SIDEBAR_IMAGE %}
<section>
<img src="{{ SITEURL }}/{{ SIDEBAR_IMAGE }}" alt="{{ SIDEBAR_IMAGE_ALT}}" width="{{SIDEBAR_IMAGE_WIDTH}}"/>
</section>
{% set all_asides = ['image', 'recentpost', 'categories', 'tags', 'github', 'social', 'links', 'twitter', 'gplus'] %}
{% if page %}
{% if page.asides is defined %}
{% set asides = page.asides.split(",") %}
{% else %}
{% set asides = PAGE_ASIDES|default(all_asides) %}
{% endif %}
<section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
{% for article in articles[:5] %}
<li class="post">
<a href="{{ SITEURL }}/{{ article.url }}">{{ article.title|striptags }}</a>
</li>
{% endfor %}
</ul>
</section>
{% if categories %}
<section>

<h1>Categories</h1>
<ul id="recent_posts">
{% for category, articles in categories %}
<li><a href="{{ SITEURL }}/{{ category.url }}">{{ category }}</a></li>
{% endfor %}
</ul>
</section>
{% endif %}

<section>
<h1>Tags</h1>
{% for tag, article in tags %}
<a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>{% if not loop.last %},{% endif %}
{% endfor %}
</section>
{% elif article %}
{% if article.asides is defined %}
{% set asides = article.asides.split(",") %}
{% else %}
{% set asides = ARTICLE_ASIDES|default(all_asides) %}
{% endif %}
{% else %}
{% set asides = INDEX_ASIDES|default(all_asides) %}
{% endif %}

{% include '_includes/github.html' %}
{% include '_includes/social.html' %}
{% include '_includes/links.html' %}
{% include '_includes/twitter_sidebar.html' %}
{% include '_includes/gplus_sidebar.html' %}
{% if sidebar != "off" %}
<aside class="sidebar">
{% if asides %}
{% for aside in asides %}
{% set aside = aside.strip().replace(".html", "") %}
{% if aside %}
{% include '_includes/asides/' + aside + ".html" ignore missing %}
{% endif %}
{% endfor %}
{% endif %}
</aside>
{% endif %}
5 changes: 4 additions & 1 deletion templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
{% include '_includes/article.html' %}
<footer>
{% include '_includes/article_infos.html' %}
{% include '_includes/article_neighbors.html' %}
{% include '_includes/sharing.html' %}
</footer>
</article>

{% if DISQUS_SITENAME and SITEURL and article.status != "draft" %}
{% set comments = article.comments|default("on") %}
{% set comments = comments|string|lower|replace("true", "on")|replace("false", "off") %}
{% if comments != "off" and DISQUS_SITENAME and SITEURL and article.status != "draft" %}
<section>
<h1>Comments</h1>
<div id="disqus_thread" aria-live="polite">{% include '_includes/disqus_thread.html' %}</div>
Expand Down
10 changes: 9 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@
{% endif %}
</head>

<body>
{% if page %}
{% set sidebar = page.sidebar|default("on") %}
{% elif article %}
{% set sidebar = article.sidebar|default("on") %}
{% else %}
{% set sidebar = "on" %}
{% endif %}
{% set sidebar = sidebar|string|lower|replace("true", "on")|replace("false", "off") %}
<body {% if sidebar == "off" %} class="no-sidebar" {% endif %}>
<header role="banner">{% include '_includes/header.html' %}</header>
<nav role="navigation">{% include '_includes/navigation.html' %}</nav>
<div id="main">
Expand Down
9 changes: 9 additions & 0 deletions templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@ <h1 class="entry-title">{{ page.title }}</h1>
</header>
{{ page.content }}
</article>

{% set comments = page.comments|default("off") %}
{% set comments = comments|string|lower|replace("true", "on")|replace("false", "off") %}
{% if comments != "off" and DISQUS_SITENAME and SITEURL %}
<section>
<h1>Comments</h1>
<div id="disqus_thread" aria-live="polite">{% include '_includes/disqus_thread.html' %}</div>
</section>
{% endif %}
</div>
{% endblock %}