Some useful hooks for wok, the static website generator.
Features are a comment system, auto upload and a timeline based on external sources like github or diaspora.
Upload the website output via ftp or ssh/sftp.
{
"sftp_password": "secret",
"sftp_host": "example.tld",
"sftp_user": "username",
"output_path": "/usr/share/nginx/www/",
"type": "sftp",
"sftp_port": "22"
}
The comment system is based on wok sub pages, so it will work for blog posts but not for the blog itself.
Loads comments from IMAP. The referenced page is defined by the page slug as mail subject. So an simple mailto link and an for-loop for the comments in the page HTML will be necessary to have comments in the page.
{
"password": "secret password magic",
"user": "username",
"server": "mailserver.example.tld"
}
<div>
{% for comment in page.subpages %}
<div>
{{comment.author}}
{{ comment.datetime.strftime('%c') }}
{{ comment.content }}
</div>
{% endfor %}
<div>
<a href="mailto:YOUR_CONTACT_EMAIL@EXAMPLE.TLD?subject={{ page.category[0]|safe }}%2F{{ page.slug|safe }}">
Add Comment
</a>
</div>
</div>
Don't forget to replace comment@example.tld in the comment link.
Remove temp files before generating the website.
Generation of (small) (activity based) posts.
{% for events in site.slugs['timeline'].subpages|sort(attribute='datetime',reverse=True)|batch(10) %}
{% if loop.first %}
{% for event in events %}
<div timeline_update">
<div class="timeline_actions_json" style="display:none">
{{ event.actions }}
</div>
<div>
{{ event.datetime.strftime('%x') }}
</div>
<p>
{{ event.content }}
</p>
</div>
{% endfor %}
{% endif %}
{% endfor %}
Add public diaspora posts to the timeline.
{
"pod": "joindiaspora.com",
"user": "username"
}
Add public github activities to the timeline.
{
"user": "abbgrade"
}
Add public digg recommendations to the timeline.
Get your id from the digg-setting page on "Privacy/Diggs" and set it to Public. An url appears, which contains the id between http://digg.com/user/ and /diggs.rss. Add that string in the digg.config
{
"secret_user_id": "#HERE#"
}
Add wikipedia contributions to the timeline.
{
"lang": "de",
"user": "username"
}
Import of contact data from vcard files.
Read vcard files adds the contact data as metadata in generated markdown files.
{% set person = page %}
<dl typeof="schema:Person">
<span property="schema:name" content="{{ person.name }}"></span>
<span property="schema:url" content="{{ person.url }}"></span>
{% if person.email %}
<dt>
EMail
</dt>
<dd>
<a href="mailto:{{ person.email }}" property="schema:email">
{{ person.email }}
</a>
</dd>
{% endif %}
{% if person.gpg %}
<dt>
PGP
</dt>
<dd>
<a href="{{ person.gpg[1] }}">
Public Key
</a>
- Fingerprint:
<small>
{{ person.gpg[0] }}
</small>
</dd>
{% endif %}
{% if person.links %}
{% for link_title, link_uri in person.links %}
<dt>
{{ link_title }}
</dt>
<dd>
<a href="{{ link_uri }}" rel="me" property="schema:sameAs">
{{ link_uri }}
</a>
</dd>
{% endfor %}
{% endif %}
</dl>