mirror of
https://github.com/balkian/balkian.github.com.git
synced 2024-12-26 10:18:13 +00:00
Added tags
This commit is contained in:
parent
bb6c1b8a1e
commit
42a247c89f
@ -450,7 +450,10 @@ footer a:hover {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
clear: both;
|
clear: both;
|
||||||
border-top: dashed 1px #CCC;
|
border-top: dashed 1px #CCC;
|
||||||
|
padding: 0.2em;
|
||||||
|
padding-top: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entries dd {
|
.entries dd {
|
||||||
float: right;
|
float: right;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
@ -471,8 +474,13 @@ a:hover {
|
|||||||
-webkit-transform-origin: 95% 50%;
|
-webkit-transform-origin: 95% 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
margin: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.tag * {
|
.tag * {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hll {
|
.hll {
|
||||||
@ -494,3 +502,20 @@ a:hover {
|
|||||||
content: " •";
|
content: " •";
|
||||||
color: #666;
|
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;
|
||||||
|
}
|
@ -15,7 +15,7 @@
|
|||||||
<h2 class="title">{{ article.title }}</h2>
|
<h2 class="title">{{ article.title }}</h2>
|
||||||
<span class="meta date">{{ article.date | date_to_string }}</span>
|
<span class="meta date">{{ article.date | date_to_string }}</span>
|
||||||
{% for c in article.tags %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -27,9 +27,18 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<ul class="nav navbar-nav">
|
<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>
|
<a href="/"><i class="fa fa-home fa-large"></i></a>
|
||||||
</li>
|
</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 %}
|
{% for p in pages %} {% if "/page" in p.url %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if p.url != "/index.html" %}
|
{% if p.url != "/index.html" %}
|
||||||
@ -90,7 +99,7 @@
|
|||||||
{% for p in articles[:5] %}
|
{% for p in articles[:5] %}
|
||||||
<dt><a href="{{ SITE_URL }}/{{ p.url }}">{{ p.title }}</a></dt>
|
<dt><a href="{{ SITE_URL }}/{{ p.url }}">{{ p.title }}</a></dt>
|
||||||
{% for c in p.tags %}
|
{% 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 %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</dl>
|
</dl>
|
||||||
@ -120,7 +129,7 @@
|
|||||||
<li><a href="http://facebook.com/balkian"><i class="fa fa-facebook"></i></a></li>
|
<li><a href="http://facebook.com/balkian"><i class="fa fa-facebook"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
Creative Commons A-SA-NC
|
<i class="fa fa-creative-commons"></i> Creative Commons A-SA-NC
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,13 +28,13 @@ balkian.com
|
|||||||
<h2><a href="{{ SITE_URL }}/{{ post.url }}" class="title">{{ post.title }}</a></h2>
|
<h2><a href="{{ SITE_URL }}/{{ post.url }}" class="title">{{ post.title }}</a></h2>
|
||||||
<span class="date">{{ post.date | date_to_string }}</span>
|
<span class="date">{{ post.date | date_to_string }}</span>
|
||||||
{% for c in post.tags %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="excerpt">
|
<div class="excerpt">
|
||||||
{{ post.summary }}
|
{{ post.summary }}
|
||||||
</div>
|
</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 %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if articles_paginator.num_pages > 0 %}
|
{% if articles_paginator.num_pages > 0 %}
|
||||||
|
10
balkiantheme/templates/tags.html
Normal file
10
balkiantheme/templates/tags.html
Normal 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 %}
|
15
content/cheats/2015-12-10-org-tricks.rst
Normal file
15
content/cheats/2015-12-10-org-tricks.rst
Normal 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)
|
||||||
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*- #
|
# -*- coding: utf-8 -*- #
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
from functools import partial
|
||||||
|
from collections import Counter
|
||||||
|
|
||||||
AUTHOR = u'J. Fernando S\xe1nchez'
|
AUTHOR = u'J. Fernando S\xe1nchez'
|
||||||
SITENAME = u'balkian.com'
|
SITENAME = u'balkian.com'
|
||||||
@ -35,11 +37,6 @@ DEFAULT_PAGINATION = 10
|
|||||||
#RELATIVE_URLS = True
|
#RELATIVE_URLS = True
|
||||||
THEME = "balkiantheme"
|
THEME = "balkiantheme"
|
||||||
|
|
||||||
def date_to_string(date):
|
|
||||||
return date.strftime('%Y-%m-%d')
|
|
||||||
|
|
||||||
JINJA_FILTERS = {'date_to_string': date_to_string}
|
|
||||||
|
|
||||||
PLUGIN_PATHS = ["plugins/",]
|
PLUGIN_PATHS = ["plugins/",]
|
||||||
PLUGINS = ["neighbors",]
|
PLUGINS = ["neighbors",]
|
||||||
|
|
||||||
@ -60,3 +57,31 @@ IGNORE_FILES = ['.*']
|
|||||||
MENUITEMS=[('CV','http://jfernando.es')]
|
MENUITEMS=[('CV','http://jfernando.es')]
|
||||||
|
|
||||||
DISPLAY_PAGES_ON_MENU=True
|
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
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user