1
0
mirror of https://github.com/balkian/balkian.github.com.git synced 2024-11-13 23:22:29 +00:00

Added tags

This commit is contained in:
J. Fernando Sánchez 2015-12-10 15:44:10 +01:00
parent bb6c1b8a1e
commit 42a247c89f
7 changed files with 95 additions and 11 deletions

View File

@ -450,7 +450,10 @@ footer a:hover {
font-weight: bold;
clear: both;
border-top: dashed 1px #CCC;
padding: 0.2em;
padding-top: 0.5em;
}
.entries dd {
float: right;
margin: 2px;
@ -471,8 +474,13 @@ a:hover {
-webkit-transform-origin: 95% 50%;
}
.tag {
margin: 2px;
}
.tag * {
display: inline-block;
color: black;
}
.hll {
@ -494,3 +502,20 @@ a:hover {
content: " •";
color: #666;
}
.readmore {
background: #EAEAEA;
padding: 0.5em;
color: white;
border-radius: 0.5em;
margin: 1em auto;
display: inline-block;
}
.readmore:hover {
background: #DADADA;
}
.readmore a {
color: black;
}

View File

@ -15,7 +15,7 @@
<h2 class="title">{{ article.title }}</h2>
<span class="meta date">{{ article.date | date_to_string }}</span>
{% for c in article.tags %}
<a class="tag" href="/tag/{{ c }}.html"><span class="label label-default">{{ c }}</span></a>
<span class="tag"><a href="/tag/{{ c }}.html" class="label label-default">{{ c }}</a></span>
{% endfor %}
</div>

View File

@ -27,9 +27,18 @@
<div class="container">
<div class="navbar-header">
<ul class="nav navbar-nav">
<li {% if article or not page %}class="active" {% endif %}>
<li {% if page_name == 'index' %}class="active" {% endif %}>
<a href="/"><i class="fa fa-home fa-large"></i></a>
</li>
{% for c,carts in categories %}
<li {% if page_name and page_name == c.page_name %} class="active"
{% endif %} >
<a href="/{{ c.url }}">{{ c.name | capitalize }}</a>
</li>
{% endfor %}
<li {% if page_name == "tags" %} class="active" {%endif%}>
<a href="/tags.html">Tags</a>
</li>
{% for p in pages %} {% if "/page" in p.url %}
{% else %}
{% if p.url != "/index.html" %}
@ -90,7 +99,7 @@
{% for p in articles[:5] %}
<dt><a href="{{ SITE_URL }}/{{ p.url }}">{{ p.title }}</a></dt>
{% for c in p.tags %}
<a class="tag" href="/tag/{{ c }}.html"><dd class="label label-default">{{ c }}</dd></a>
<dd class="tag"><a class="label" href="/tag/{{ c }}.html">{{ c }}</a></dd>
{% endfor %}
{% endfor %}
</dl>
@ -120,7 +129,7 @@
<li><a href="http://facebook.com/balkian"><i class="fa fa-facebook"></i></a></li>
</ul>
<p>
Creative Commons A-SA-NC
<i class="fa fa-creative-commons"></i> Creative Commons A-SA-NC
</p>
</footer>
</div>

View File

@ -28,13 +28,13 @@ balkian.com
<h2><a href="{{ SITE_URL }}/{{ post.url }}" class="title">{{ post.title }}</a></h2>
<span class="date">{{ post.date | date_to_string }}</span>
{% for c in post.tags %}
<a class="tag" href="{{ SITE_URL }}/tag/{{ c }}.html"><span class="label label-success tag">{{ c }}</span></a>
<a class="tag" href="{{ SITE_URL }}/tag/{{ c }}.html"><span class="label">{{ c }}</span></a>
{% endfor %}
</div>
<div class="excerpt">
{{ post.summary }}
</div>
<span><a href="{{ SITE_URL }}/{{ post.url }}"><i class="icon-pl2s"></i> Read more...</a></span>
<div class="readmore"><a href="{{ SITE_URL }}/{{ post.url }}"><i class="fa fa-external-link"></i> Read more...</a></div>
{% endfor %}
{% if articles_paginator.num_pages > 0 %}

View File

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block content_title %}
{{ page_name }}
{% endblock %}
{% block content %}
<h2>Post tags</h2>
{% for tag, carticles in tags | sort_by_article_count %}
<a class="tag" href="/tag/{{ tag }}.html"><span style="font-size: {{ (articles, tag) | normalize_count * 2 }}%;" class="label label-default">{{ tag }} ({{ carticles | length }})</span></a>
{% endfor %}
{% endblock %}

View File

@ -0,0 +1,15 @@
Org-mode tricks
###############
:date: 2015-12-10 Thu 11:34:00
:tags: emacs, productivity, editor, org
:category: cheats
Show plain text version
@@@@@@@@@@@@@@@@@@@@@@@
.. code-block:: elisp
(font-lock-mode)

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from functools import partial
from collections import Counter
AUTHOR = u'J. Fernando S\xe1nchez'
SITENAME = u'balkian.com'
@ -35,11 +37,6 @@ DEFAULT_PAGINATION = 10
#RELATIVE_URLS = True
THEME = "balkiantheme"
def date_to_string(date):
return date.strftime('%Y-%m-%d')
JINJA_FILTERS = {'date_to_string': date_to_string}
PLUGIN_PATHS = ["plugins/",]
PLUGINS = ["neighbors",]
@ -60,3 +57,31 @@ IGNORE_FILES = ['.*']
MENUITEMS=[('CV','http://jfernando.es')]
DISPLAY_PAGES_ON_MENU=True
DISPLAY_CATEGORIES_ON_MENU = True
CATEGORY_URL = 'category/{slug}.html'
CATEGORY_SAVE_AS = 'category/{slug}.html'
CATEGORIES_SAVE_AS = 'categories.html'
DEFAULT_CATEGORY = 'misc'
def date_to_string(date):
return date.strftime('%Y-%m-%d')
def sort_by_article_count(x):
return sorted(x, key=lambda tags: len(tags[1]), reverse=True)
def normalize_count(x):
articles, tag = x
counter = Counter()
for i in articles:
counter.update(i.tags)
maximum = counter.most_common(1)[0][1]
return 100*counter[tag]/maximum
JINJA_FILTERS = {
'sort_by_article_count': sort_by_article_count,
'date_to_string': date_to_string,
'normalize_count': normalize_count
}