From 82371e351a35363a8b493d0063e925dce1d27008 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Tue, 5 May 2015 01:12:44 -0700 Subject: handle navigation button and favicons Note that I'm using an tag with the svg because if wrapped in , the svg won't render on Safari. After using the tag, the svg renders on all four major browsers on OS X (Chrome, Safari, Firefox, Opera), and it looks nice on all three but Firefox, in which case it's crappy as fuck. --- pyblog | 4 +- source/css/theme.css | 4 ++ source/favicon.ico | Bin 0 -> 15086 bytes source/img/README.rst | 11 ++++ source/img/favicon-144.png | Bin 0 -> 10140 bytes source/img/favicon-152.png | Bin 0 -> 10697 bytes source/img/icon.svg | 134 +++++++++++++++++++++++++++++++++++++++++++++ source/img/icon.tex | 21 +++++++ templates/template.html | 12 +++- 9 files changed, 183 insertions(+), 3 deletions(-) create mode 100644 source/favicon.ico create mode 100644 source/img/README.rst create mode 100644 source/img/favicon-144.png create mode 100644 source/img/favicon-152.png create mode 100644 source/img/icon.svg create mode 100644 source/img/icon.tex diff --git a/pyblog b/pyblog index 0b7b3d26..271a4684 100755 --- a/pyblog +++ b/pyblog @@ -304,7 +304,7 @@ def generate(fresh=False): for name in files: extension = name.split(".")[-1] - if extension not in ["css", "jpg", "md", "png", "svg"]: + if extension not in ["css", "jpg", "md", "png", "svg", "ico"]: continue relpath = os.path.join(relroot, name) @@ -320,7 +320,7 @@ def generate(fresh=False): anything_modified = True if srcpath == INDEXMD: continue # index will be processed separately - if extension in ["css", "jpg", "png", "svg"]: + if extension in ["css", "jpg", "png", "svg", "ico"]: sys.stderr.write("copying %s\n" % relpath) shutil.copy(srcpath, dstpath) elif extension == "md": diff --git a/source/css/theme.css b/source/css/theme.css index 60308aac..f125cc03 100644 --- a/source/css/theme.css +++ b/source/css/theme.css @@ -9,6 +9,10 @@ nav { top: 10%; } +nav a { + text-decoration: none; +} + article { position: absolute; width: 50%; diff --git a/source/favicon.ico b/source/favicon.ico new file mode 100644 index 00000000..b689de91 Binary files /dev/null and b/source/favicon.ico differ diff --git a/source/img/README.rst b/source/img/README.rst new file mode 100644 index 00000000..cb7a633c --- /dev/null +++ b/source/img/README.rst @@ -0,0 +1,11 @@ +The icon and favicon files are generated via the following commands: :: + + cd source/img + xelatex icon.tex + convert icon.pdf icon.svg + for size in 16 32 48 144 152; do convert icon.pdf -density 400 -resize ${size}x${size} favicon-${size}.png; done + optipng favicon-16.png favicon-32.png favicon-48.png favicon-144.png favicon-152.png + convert favicon-16.png favicon-32.png favicon-48.png ../favicon.ico + rm favicon-16.png favicon-32.png favicon-48.png + +Credit to `audreyr/favicon-cheat-sheet `_ for favicon handling tips. diff --git a/source/img/favicon-144.png b/source/img/favicon-144.png new file mode 100644 index 00000000..dec50e02 Binary files /dev/null and b/source/img/favicon-144.png differ diff --git a/source/img/favicon-152.png b/source/img/favicon-152.png new file mode 100644 index 00000000..d4ce37f2 Binary files /dev/null and b/source/img/favicon-152.png differ diff --git a/source/img/icon.svg b/source/img/icon.svg new file mode 100644 index 00000000..e74fd042 --- /dev/null +++ b/source/img/icon.svg @@ -0,0 +1,134 @@ + + + + diff --git a/source/img/icon.tex b/source/img/icon.tex new file mode 100644 index 00000000..c4efccc3 --- /dev/null +++ b/source/img/icon.tex @@ -0,0 +1,21 @@ +%%% Local Variables: +%%% coding: utf-8 +%%% mode: latex +%%% TeX-engine: xetex +%%% End: + +\documentclass{standalone} +\usepackage{xltxtra} +\usepackage{tikz} + +\setmainfont{Helvetica Neue} + +\begin{document} + +\tikz { + \fill[fill=none](0,0) circle (10); + \draw[draw=none,fill=black!20!white] (0,0) circle (10); + \node[text=white,scale=20.0] at (0,0) {ZW}; +} + +\end{document} diff --git a/templates/template.html b/templates/template.html index ff6c5f5a..ba826be1 100644 --- a/templates/template.html +++ b/templates/template.html @@ -8,6 +8,9 @@ $if(date)$ $endif$ $pagetitle$ + + + $if(quotes)$ @@ -31,6 +34,13 @@ $endfor$ + -- cgit v1.2.1