A Page with the Contents of an ABlog Sidebar
I wanted to use the sphinx RTD
Theme
(demo) for my
ablog based website. This was fairly easy
to do. One problem that I had with using a theme different than the
default alabaster theme was
getting the sidebar contents to look good or to be present at all. When
I used the bootstrap
theme
(demo),
there are some differences between it and the alabaster theme that made
my blog look not quite right. When I used the RTD theme, the pages
looked good but the RTD theme dedicates the sidebar to the
non-customizable RTD table of contents. So I was down to three choices:
1) live with the alabaster theme, which has all of the right ablog
contents, but I really dislike the italic looking font for all of
the body content
2) use the bootstrap theme, which overall looks good but the sidebar
was not quite right
3) use the RTD theme, which looks great but does not have a sidebar
with conventional blog content such as a tag cloud, list of
categories, or archive list by year, all of which are available in
the html sidebar.
I posted issue 66 with the
ablog project. Before it was answered, I came across a stack overflow
question/answer: Override html page template for a specific sphinx
document.
The approach provided in the
answer to this question
seems to satisfy my needs.
I use a custom _templates/page.html that applies special logic with
contents from _templates/sidebar_page.html when it is used for the
page named pages/sidebar_page. Below are the contents of the three
files:
_templates/page.html
{% extends "layout.html" %}
{% block body %}
{% if pagename == 'pages/sidebar_page' %}
{% include 'sidebar_page.html' %}
{% else %}
{{ body }}
<hr></hr>
{% include 'postcard.html' %}
<p></p>
{% endif %}
{% endblock %}
_templates/sidebar_page.html
{% block body %}
<!-- {% include 'searchbox.html' %} -->
{% include 'about.html' %}
{{ body }}
{% include 'tagcloud.html' %}
<p></p>
{% include 'recentposts.html' %}
<p></p>
{% include 'categories.html' %}
<p></p>
{% include 'archives.html' %}
<p></p>
{% include 'authors.html' %}
{% endblock %}
pages/sidebar_page.rst
.. _sidebar_page:
********************
Blog Overview |rss|
********************
This is my overview of the blog.
These changes seem to fully address the issue. I am now able to use the
RTD theme and still have a custom page that has the normal blog overview
information.