customize tinkerer page
sidebar items
You can customize items in sidebar (right side of this page) by modifying values in dictionary, html_sidebars.
For example, if you would like to show tags, then add “tags.html” as follows.
# Add templates to be rendered in sidebar here
html_sidebars = {
"**": ["recent.html", "searchbox.html", "tags.html"]
}
tinkerer documentation will help you configure customization.
tweet button
You can add tweet button on each post. Here is sample code needed to be added in page.html file under _templates directory.
<!-- Twitter button -->
<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
This code can be created mannualy by referencing twitter site.
google analytics
You can take statistics of your blog by google analytics. oN google analytics site create Tracking ID for your blog site, which yields javascript like this.
Please be noted that you have to exclude <script> tags.
(function(i,s,o,g,r,a,m){
i['GoogleAnalyticsObject']=r;
i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)
},i[r].l=1*new Date();
a=s.createElement(o),m=s.getElementsByTagName(o)[0];
a.async=1;
a.src=g;
m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxxxx-1', '<your_site>');
ga('send', 'pageview');
Save this code as google_analytics.js under _static directory.
And add following lines into page.html so as to incorporate this javascript.
{% extends "!page.html" %}
{% set script_files = script_files + ["_static/google_analytics.js"] %}
With above configurations applied, you will see page.html as follows.
{% extends "!page.html" %}
{% set script_files = script_files + ["_static/google_analytics.js"] %}
{%- block body %}
<div class="section_head">
<div class="timestamp_layout">
{{ timestamp(metadata.formatted_date) }}
</div>
{% block buttons %}
<div class="buttons">
<!-- Twitter button -->
<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</div>
{% endblock %}
</div>
{{ link }}
{{ body }}
{{ post_meta(metadata) }}
{{ comments }}
{% endblock %}
enable sshd
By default, sshd is disabled on ubuntu desktop. Therefore you need to install & enable sshd if you would like to access host remotely via ssh.
Here is short memo for this sake.
First, search for sshd package via apt-cache command.
$ sudo apt-cache search sshd
openssh-server - secure shell (SSH) server, for secure access from remote machines
$ sudo apt-cache show openssh-server
Package: openssh-server
...
Description-en: secure shell (SSH) server, for secure access from remote machines
...
This package provides the sshd server.
OK, openssh-server seems to be what we are looking for.
$ sudo apt-get install openssh-server
Installation will automatically start sshd daemon.
$ sudo lsof -nPi:22
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 3557 root 3u IPv4 35564 0t0 TCP *:22 (LISTEN)
sshd 3557 root 4u IPv6 35566 0t0 TCP *:22 (LISTEN)
$ sudo service ssh status
ssh start/running, process 3557
Please be noted, sshd daemon is registered not as sshd but as ssh.
sshd configuration can be set in /etc/ssh/sshd_config. In case that you would like to disable remote root access, then change parameter PermitRootLogin value from yes to no.
PermitRootLogin no
swap Caps Lock key with Ctrl key
I have been using Happy Hacking Keyboard (HHK) for about decade. It’s really nice one, but it becomes lame at last and key touch is quite noisy. So I bought a cheap English layout keyboard at amazon. (good-by HHK)
The problem here is that “caps lock” resides in the left-middle. This is quite inconvenient. So I replaced “caps lock” key with “control” by configuring keyboard mapping.
Here is its procedure on ubuntu 13.04 (LXDE) to do so.
Edit keyboard file and applying argument “ctrl:swapcaps” for XKBOPTIONS option.
$ cd /etc/default
$ diff keyboard keyboard.org
11,12c11
< #XKBOPTIONS=""
< XKBOPTIONS="ctrl:swapcaps"
---
> XKBOPTIONS=""
Or you can specify “ctrl:nocaps” in case that you assign control key for both.
Then execute dpkg-reconfigure command so that above change will take effect. Please be noted that rebooting system has no effect for this keyboard configuration change and it remains as they were.
$ sudo dpkg-reconfigure keyboard-configuration
Answer to questions given by command and at last stage you will be prompted if you save above configuration change.
Following emacs page has quite comprehensive explanation for this sake, which helps must help you.
And following debian page has explanation as to keyboard configuration.
Please be noted, above dpkg-reconfigure command updates initrd.img-X.X.X-XX-generic file under /boot directory. Therefore in case that OS updates image file, then you have to re-execute dpkg-reconfigure command to reflect change onto image file.
Please be noted that there seems to be more work to be done, as change of configuration is lost after rebooting system. sorry...
It seems that following thread shall be similar issue of this.