Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Create a new blog:
Create a new page or post:

blo post hello-world
blo post about --type page

You can also use pipe with your favorite editor:

Expand Down
2 changes: 1 addition & 1 deletion blo/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from http.server import SimpleHTTPRequestHandler
from http.server import HTTPServer

from .page_generator import PageGenerator
from page_generator import PageGenerator



Expand Down
12 changes: 11 additions & 1 deletion blo/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,15 @@
}
},
"date_format": "%Y-%m-%d %H:%M",
"items_per_page": 12
"items_per_page": 12,
"lang":{
"fa":{
"Posts_with_tag": "پستهای تگ شده با ",
"List_of_tags": "لیست تگها"
},
"en":{
"Posts_with_tag":"Posts with tag ",
"List_of_tags": "List of tags"
}
}
}
3 changes: 2 additions & 1 deletion blo/page_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import codecs
import os
from datetime import datetime
from pprint import pprint

import jinja2
import markdown
Expand Down Expand Up @@ -70,7 +71,7 @@ def _generate_html_tag_pages(self, tag):
items_pages = []
for page_number, item_set in enumerate(pages):
page_vars = {
'page_title': "Posts with tag '{0}'".format(tag),
'page_title': self.config['lang'][self.config['site']['lang']]['Posts_with_tag']+" '{0}'".format(tag),
'tag': tag,
'page_items': item_set,
'page_number': page_number,
Expand Down
138 changes: 95 additions & 43 deletions blo/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,88 +1,140 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>{% block title %}{% endblock %}</title>
<meta name="description" content="{% if page_briefing %}{{ page_briefing }}{% else %}{{ site_briefing }}{% endif %}"/>
<meta name="keywords" content="{% if page_tags %} {{ page_tags|join(', ') }}{% endif %}" />
<meta name="description"
content="{% if page_briefing %}{{ page_briefing }}{% else %}{{ site_briefing }}{% endif %}"/>
<meta name="keywords" content="{% if page_tags %} {{ page_tags|join(', ') }}{% endif %}"/>

<!-- Bootstrap -->
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/paper/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

<link href="https://rawgit.com/richleland/pygments-css/master/github.css" rel="stylesheet" crossorigin="anonymous">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
p {
font-size: 1.3em;
line-height: 1.5em;
}

#back2Top {
width: 40px;
line-height: 40px;
overflow: hidden;
z-index: 999;
display: none;
cursor: pointer;
-moz-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-o-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
position: fixed;
bottom: 50px;
right: 0;
background-color: #DDD;
text-align: center;
font-size: 30px;
text-decoration: none;
}
#back2Top:hover {
background-color: #DDF;
color: #000;
}

</style>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">{{ site_title }}</a>
<a class="navbar-brand" href="/">{{ site_title }}</a>
</div>
<ul class="nav navbar-nav navbar-right">
{% if site_links %}
{% for title, link in site_links.items() %}
<li><a href="{{ link }}">{{ title }}</a></li>
{% endfor %}
{% for title, link in site_links.items() %}
<li><a href="{{ link }}">{{ title }}</a></li>
{% endfor %}
{% endif %}
</ul>
</div>
</nav>
</ul>
</div>
</nav>

<div class="container">
<div class="row">
<div class="container">
<div class="row">

<div class="col-md-8 col-md-offset-2">
{% block content %}
{% endblock %}
</div>
</div>
</div>
<hr />
<footer>
<div class="container">
</div>
<hr/>
<footer>
<div class="container">
<div class="row">
<div class="col-md-4">
<strong>Technical blog</strong>
<ul>
<li><a href="/">All posts</a></li>
<li><a href="/tags.html">List of tags</a></li>
</ul>
<strong>Technical blog</strong>
<ul>
<li><a href="/">All posts</a></li>
<li><a href="/tags.html">List of tags</a></li>
</ul>
</div>
<div class="col-md-4">
{% if site_footer_links %}
<strong>See also</strong>
<ul>
{% for title, link in site_footer_links.items() %}
{% if site_footer_links %}
<strong>See also</strong>
<ul>
{% for title, link in site_footer_links.items() %}
<li><a href="{{ link }}">{{ title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</div>
<div class="col-md-4">
<p class="text-center"><small>{{ site_url }} &copy; 2015</small></p>
<p class="text-center"><small>{{ site_url }} &copy; 2015</small></p>
</div>
</div>
</div>
</footer>
</div>
</footer>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd"
crossorigin="anonymous"></script>
<script>
/*** https://html-online.com/articles/dynamic-scroll-back-top-page-button-javascript ***/
/*Scroll to top when arrow up clicked BEGIN*/
$(window).scroll(function() {
var height = $(window).scrollTop();
if (height > 100) {
$('#back2Top').fadeIn();
} else {
$('#back2Top').fadeOut();
}
});
$(document).ready(function() {
$("#back2Top").click(function(event) {
event.preventDefault();
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});

});
/*Scroll to top when arrow up clicked END*/

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha256-KXn5puMvxCw+dAYznun+drMdG1IFl3agK0p/pqT9KAo= sha512-2e8qq0ETcfWRI4HJBzQiA3UoyFk6tbNyG+qSaIBZLyW9Xf3sWZHN/lxe9fTh1U45DpPf07yj94KsUHHWe4Yk1A==" crossorigin="anonymous"></script>
</body>
</script>
<a id="back2Top" title="Back to top" href="#">&#10148;</a>
</body>
</html>
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
name='blo',
version='0.6',
license='BSD-3-clause',
author='Yann Savuir',
author_email='savuir@gmail.com',
author='Sajjad Shahcheraghian',
author_email='shgninc@gmail.com',
packages=find_packages(),
entry_points={
'console_scripts': [
Expand All @@ -16,7 +16,7 @@
install_requires=['jinja2', 'markdown', 'PyRSS2Gen'],
package_data={'': ['blo/default.json', 'blo/draft_templates.json',]},
include_package_data=True,
url='https://github.com/savuir/blo', # use the URL to the github repo
url='https://github.com/shgninc/blo', # use the URL to the github repo
download_url='https://github.com/savuir/blo/tarball/0.1', # I'll explain this in a second
keywords=['blogging', 'blog', 'static blog generator'], # arbitrary keywords
)