Tagged with html

Transparent favicons with Paint.NET

I've spent longer than I should have figuring out how to do this. Which means: post about it to make it seem like I've done some work. Hopefully this saves someone some time.

To make a transparent favicon.ico file using Paint.NET, download the IcoCur.dll plugin from Evan Olds (thank you!) and save it in the FileTypes folder in the Paint.NET directory.

Then, create a 16x16 pixel file, with a background whose alpha channel is 0. Save the file, and you can now save a .ico. I've included only the 16x16, 32 bit image to make the favicon as small as possible.

Now, the little icon thingy in the top of your browser will look nice independent of the browser chrome.

Tagged , ,

Building a website with Pelican

So you want to get a website up, but would rather mess around with getting your site hosting framework perfect rather than generating actual content? Me too.

If you want to try static website content hosting and you're a python fan, Pelican seems to be a great choice. Supports Markdown, my minimalist text format of choice. I looked at hyde thinking it would be the python alternative to Jekyll, which people seem to love, but it seemed too complicated. With Pelican, you can write a single isolated blog post in markdown and have a website. As an experienced blogger (I've been blogging for all of 10 minutes now), that's what I want.

Overview

You'll generate a site skeleton with pelican-quickstart. You'll put blogposts as separate files in yoursite/content. E.g., yoursite/content/firstpost.md. Sitewide settings are in pelicanconf.py. You'll run

make html

which will generate all the content. You'll upload the content to your host of choice with something like

make rsync_upload

During development, you'll host your website locally with

make devserver

Just go to http://localhost:8000 to see your site.

Getting Started

The pelican documentation is great. Follow it.

Themes

Pelican comes with two themes built in, but there are many more on github. Let's see how easy it is to try them out. Change to a development directory and

git clone --recursive git://github.com/getpelican/pelican-themes.git

Be sure that --recursive is there, because some of the themes are included as submodules. I got some errors on this step because the url used for the submodules are formatted differently (e.g., http vs. https vs. git@github.com) and putty complained that their keys weren't cached. SSH into the offending url to update your cache. Also, it seems that you need a github key to get all of them. So, try leaving out the --recursive if you just want it to work, but some of the themes will be empty folders (e.g., chunk iris neat pelican-mockingbird relapse svbtle).

Now, lets install all of the themes so we can try them out. Just to be quick and dirty about it, lets do this manually. Change to the pelican-themes directory and

pelican-themes -i Just-Read basic bootlex bootstrap bootstrap2 brownstone built-texts cebong dev-random dev-random2 lightweight martyalchin mnmlist notmyidea-cms-fr notmyidea-cms sneakyidea subtle syte tuxlite_tbs waterspill-en waterspill chunk iris neat pelican-mockingbird relapse svbtle

Just to check this worked

pelican-themes --list

should list everything above.

Now, to try out a theme, just add (or change) in pelicanconf.py:

THEME="svbtle"

Great. Now, you can just flick through all of the themes that other people have worked really hard to build and convince yourself you are 'designing' a website.

Deployment

It's really just copying, right? Pelican has some built in options for deploying, using rsync over ssh to save on transfer. But, I use windows because I like things difficult, and getting rsync working on windows is... difficult, especially if you are trying to do it with putty/plink. (I believe an older version of cwRsync is the closest, but then see here and here for workarounds. You can also try installing rsync with the MSYS developer tools, but it has the same plink issue.)

So, winscp has some rsync like functionality. Put this into a deploy.bat:

winscp.com /command "open username@webhost.com" "synchronize remote -delete -mirror -criteria=either -filemask=|*~;*#;*.pyc output/ /home/username/website/" "exit"

replacing all of the relevant fields. You need the 5.x version of winscp to use the filemask option.

Sweet! That's all for now.

Tagged , , ,