Added page title as primary heading

Added read more links to newsfeed
Better templates for news in test folder
Smaller cleanups
This commit is contained in:
Sebastian 2016-01-25 16:13:00 +01:00
parent 1a760e43a9
commit d2fe5d01d5
7 changed files with 26 additions and 7 deletions

View File

@ -6,6 +6,7 @@
{{menu}}
<br/>
{% block content %}
<h1 class="mainheading">{{page_title}}</h1>
{{content}}
<br/>
Created: {{content_creation_time.strftime('%d.%m.%Y %H:%M:%S')}}</br>

View File

@ -2,7 +2,11 @@
{% block content %}
{{items | pprint}}
{% for item in items %}
<div>
<h2>{{item.title}}</h2>
{{item.content}}
</div>
{% endfor %}
{% endblock %}

View File

@ -1 +1,13 @@
{{items | pprint}}
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
{% for item in items %}
<item>
<title>{{item.title}}</title>
<url>{{item.url}}</url>
<description>{{item.content}}</description>
<pubDate>{{item.creation_time.strftime('%d.%m.%Y %H:%M:%S')}}</pubDate>
</item>
{% endfor %}
</channel>
</rss>

View File

@ -8,3 +8,4 @@ MARKDOWN_EXTENSIONS = ['markdown.extensions.sane_lists',
SERVE_PORT = 8000
SERVE_BIND_ADDRESS = "0.0.0.0"

View File

@ -66,8 +66,6 @@ class NewsFeed(MenuItemMixin, TemplateMixin, AssetsMixin):
rendered_items = sorted(rendered_items, key=lambda item: item['creation_time'], reverse=True)
context['items'] = rendered_items
print rendered_items
return context

View File

@ -35,6 +35,8 @@ class Page(MenuItemMixin, NewsItemMixin, TemplateMixin, AssetsMixin):
lines = self.content['content'].split('\n')
elipsized_content = '\n'.join(lines[0:self.news_item_len])
elipsized_content += '\n\n Read [more](%s) ...' % self.url
item = {
'title': self.title,
'content': elipsized_content,

View File

@ -9,7 +9,7 @@ from SimpleHTTPServer import SimpleHTTPRequestHandler
from constants import OUTPUT_DIRECTORY, TEMPLATE_DIRECTORY, SERVE_PORT
from constants import OUTPUT_DIRECTORY, TEMPLATE_DIRECTORY, SERVE_PORT, SERVE_BIND_ADDRESS
class Verdandi(object):
@ -58,5 +58,6 @@ class Verdandi(object):
if len(sys.argv) > 1 and sys.argv[1] == 'serve':
os.chdir(self.output_directory)
httpd = SocketServer.TCPServer(("0.0.0.0", SERVE_PORT), SimpleHTTPRequestHandler)
httpd = SocketServer.TCPServer((SERVE_BIND_ADDRESS, SERVE_PORT), SimpleHTTPRequestHandler)
print "Serving under %s:%d" % (SERVE_BIND_ADDRESS, SERVE_PORT)
httpd.serve_forever()