🕹ī¸ Do Something Great! 😄

Tag: pelican

  • Updating Twitter and Facebook with blog updates

    Now that I’ve switched from WordPress to Pelican I’m face with the dilemma on how to update Twitter and Facebook when I post to my blog. In WordPress I used the Social Plugin by MailChimp to automatically post, but plugins are not an option with a static website.

    But as I was working on a recipe in If This Then That – IFTTT this morning it hit me, I can use IFTTT to automatically post a link to my new blog posts in Twitter and Facebook. To create the recipe:

    1. Create an If This Then That account at IFTTT.
    2. Click Channels and add your Twitter account and Facebook page (or your Facebook account, depending on how you use Facebook).
    3. Click Create
    4. Use an RSS Feed for This and your Twitter account or Facebook account (or page) for That.
  • Scheduled posting with Pelican

    After my switch from WordPress to Pelican I realized that there was one feature that I really was missing, the ability to schedule posts in the future. When you have an itch, you scratch it. By using my Linux box at home (you could use an OS X machine also) and Dropbox, I can now schedule posts.

    Prequisites

    On my server I set up Dropbox. There is a script on the Dropbox site that allows you to set it up on headless servers (a server without a monitor, keyboard, or mouse). In my DropBox folder, I created a folder called ToPost.

    The script

    You’ll need to adjust the path to TOPOST and to the SITE.

    #!/bin/bash
    
    TOPOST=~/Dropbox/Elements/RyanCollins.org/ToPost/*.markdown
    SITE=~/Development/ryancollins.org
    
    shopt -s nullglob
    
    YEAR=`date +%Y`
    NOW=`date +"%Y-%m-%d %H:%M"`
    
    for file in ${TOPOST}
    do
        DATELINE=`cat "${file}" | grep "^Date: "`
        if [[ ${DATELINE#* } < ${NOW} ]]; then
            mv "${file}" "${SITE}/content/${YEAR}"
            cd "${SITE}"
            make rsync_upload
        fi
    done
    

    Scheduling

    At the command prompt, run crontab with the -e parameter so we can add a scheduled job:

    ryan@serverbot:~$ crontab -e
    

    and add a line to our script to run it every 15 minutes:

    */15    *   *   *   *    /home/ryan/Development/ryancollins.org/dbupdate.sh
    
  • Good bye WordPress, hello Pelican

    This website has undergone various transformations over the last 10 years. Looking back at the first incarnations from 2003 shows a site that reminds me a lot of current day Facebook and Twitter. An example of my words of wisdom from 2003:

    And tonight marks the end of a great TV series that it seemed like nobody was watching. Buffy the Vampire Slayer ends its seven season run with the episode “Chosen”.

    I feel that this series never got the recognition it deserved, with such great episodes like Hush and Once more with Feeling, the creator Joss Whedon was never afraid to totally change your perception of characters.

    At least Angel will be back this fall, and I’ve been buying the Buffy DVDs. The plan is to watch Season 2 this fall on Tuesday nights.

    (I now own the entire series of Buffy on DVD, just in case you were worried)

    In those days I was running Postnuke, and apparently by 2005 I had switched over to WordPress, which I had used up until last month. I have nothing against WordPress, and for a majority of users, WordPress is the way to go. For myself, I was getting tired of administrating the site more than writing and I wanted more speed without jumping through a bunch of hoops. So last month I switch to Pelican

    Pelican is a website generator written in Python. The difference between something like WordPress and Pelican is that WordPress parses each web page as a user views it while Pelican generates the site ahead of time as html pages that can be uploaded anywhere. This means I can host my website any place that supports static web pages. I’m currently using a virtual private service (VPS) to host my website. When I’m tired of administrating my VPS, I can easily switch to publishing on Amazon S3. Other options include the Public folder in Dropbox or in Google Drive.

    Another aspect of Pelican I really like is the ability to check my entire site into version control (git in my case). With version control, I can easily work on new branches of the site without disturbing the current site. And, if you’re bored, you can fork the repo of the site at Github.

    My comments were already switched over to Disqus, and I was able to mimic the same urls from WordPress in Pelican. This allowed me to use my Disqus comments as is.

    There are two pieces that I need to work on. One is to set up some way to schedule posts, and the other is a theme that’s not the default. Oh, I also need to go through all my old posts and fix the categories. WordPress allowed multiple categories per post, Pelican does not.