Skip to content

Commit

Permalink
add a sidebar and format it
Browse files Browse the repository at this point in the history
Note the sidebar needs to be "included", use sed instead of Jinja2
getnikola/plugins#375
  • Loading branch information
mattip committed Feb 2, 2021
1 parent ae28012 commit 1873208
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 20 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SHELL := bash
# pypy.org static page and blog makefile
# type `make help` to see all options

Expand All @@ -14,13 +15,19 @@ all: build
venv_nikola/bin/nikola: ## create a virtualenv to build the website
> @virtualenv -ppython3 ./venv_nikola
> @venv_nikola/bin/python -mpip install nikola==8.0.3 jinja2 aiohttp watchdog ruamel.yaml feedparser
> @venv_nikola/bin/nikola plugin -i sidebar

plugins/import_blogger: venv_nikola/bin/nikola
> venv_nikola/bin/nikola plugin -i import_blogger
> venv_nikola/bin/pip install feedparser

build: venv_nikola/bin/nikola ## build the website if needed, the result is in ./public
> venv_nikola/bin/nikola build
> @for f in $$(grep "include.*sidebar-en.inc" -lr public/) ;do \
> sed -i -e'/<!-- include sidebar-en.inc -->/r public/sidebar-en.inc' $$f; \
> sed -i -e'/<!-- include sidebar-en.inc -->/d' $$f; \
> echo $${f}; \
> done;

auto: venv_nikola/bin/nikola ## build and serve the website, autoupdate on changes
> venv_nikola/bin/nikola auto -a 0.0.0.0
Expand Down
34 changes: 33 additions & 1 deletion themes/pypy/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ pre.literal-block *:last-child {
height: 32px;
}

#footer {
border-top: 1px solid #4F5151;
clear: both;
}

#container {
margin: 1em auto;
max-width: 75%;
}

.post {
float: left;
width: 70%;
}


div.sidebar {
float: left;
width: 27%;
}

.logotext {
padding-top: 4px;
}
Expand Down Expand Up @@ -75,7 +96,18 @@ pre.literal-block *:last-child {

@media screen and (max-width: 40rem) {
.row .column {
text-align: center; } }
text-align: center; }
div.sidebar {
display: none;
}
#container {
max-width: 100%;
}
div.post {
width: 95%;
}
}


.pb-4 {
padding-bottom: 6rem; }
Expand Down
8 changes: 6 additions & 2 deletions themes/pypy/messages/messages_en.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"No comments.": "No comments.",
"{0} wrote on {1}:": "{0} wrote on {1}:",
"No comments": "No comments",
"{0} comment": "{0} comment",
"{0} comments": "{0} comments",
"{0} comment": "{0} comment",
"{0} comments": "{0} comments",
"Recent Posts": "Recent Posts",
"Archives": "Archives",
"Categories": "Categories",
"Tags": "Tags",
}
2 changes: 1 addition & 1 deletion themes/pypy/templates/base_header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<section class="navigation">
<div class="nav-container">
<div class="brand">
<a href="index.html">
<a href="/index.html">
<image id="toplogo" src="/images/pypy-logo.svg" width=75px; alt=PyPy/>
</a>
</div>
Expand Down
9 changes: 8 additions & 1 deletion themes/pypy/templates/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
{% if page_links %}
{{ pagination.page_navigation(current_page, page_links, prevlink, nextlink, prev_next_links_reversed) }}
{% endif %}
<div class=post>
<div class="postindex">
{% for post in posts %}
<article class="h-entry post-{{ post.meta('type') }}" itemscope="itemscope" itemtype="http://schema.org/Article">
Expand Down Expand Up @@ -65,8 +66,14 @@
{{ static_comments.add_static_comments(post.comments, lang) }}
{% endfor %}
</div>
</div>
<div class="sidebar">
<!-- include sidebar-en.inc -->
</div>
</div>
<div style="clear: both; width: 75%; margin: 1em auto;">
{{ helper.html_pager() }}
<p> HERE IS THE COMMENT LINK SCRIPT</p>
{{ comments.comment_link_script() }}
{{ math.math_scripts_ifposts(posts) }}
</div>
{% endblock %}
35 changes: 20 additions & 15 deletions themes/pypy/templates/post.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,27 @@

{% block content %}
<article class="post-{{ post.meta('type') }} h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article">
{{ pheader.html_post_header() }}
<div class="e-content entry-content" itemprop="articleBody text">
{{ post.text() }}
<div class=post>
{{ pheader.html_post_header() }}
<div class="e-content entry-content" itemprop="articleBody text">
{{ post.text() }}
</div>
<aside class="postpromonav">
<nav>
{{ helper.html_tags(post) }}
{{ helper.html_pager(post) }}
</nav>
</aside>
{# modified for static_comments only #}
<section class="comments hidden-print">
<h2>{{ messages("Comments") }}</h2>
{{ static_comments.add_static_comments(post.comments, None) }}
</section>
{{ math.math_scripts_ifpost(post) }}
</div>
<div class="sidebar">
<!-- include sidebar-en.inc -->
</div>
<aside class="postpromonav">
<nav>
{{ helper.html_tags(post) }}
{{ helper.html_pager(post) }}
</nav>
</aside>
{# modified for static_comments only #}
<section class="comments hidden-print">
<h2>{{ messages("Comments") }}</h2>
{{ static_comments.add_static_comments(post.comments, None) }}
</section>
{{ math.math_scripts_ifpost(post) }}
</article>
{{ comments.comment_link_script() }}
{% endblock %}

0 comments on commit 1873208

Please sign in to comment.