Skip to content

Latest commit

 

History

History
161 lines (103 loc) · 7.34 KB

advanced-stuff.md

File metadata and controls

161 lines (103 loc) · 7.34 KB

Blogophon - Advanced stuff

In this document you will find some stuff for hardcore CLI wizards and server gurus.

Other means of editing articles

If you do not want to use blogophon, read the manual operations instructions.

Time zone

Your generated blog will use the time zone set by your operating system. On some systems you may not be able to set the correct time zone, so pages created and generated by the Blogophon will use the wrong time zone. For Linux / Mac OSX there is a workaround on how to supply the correct time zone when starting Blogophon's scripts:

export TZ='Europe/Berlin'; blogophon-generate

…where Europe/Berlin can be replace with any TZ value from the tz database.

This will also work with cronjobs (see below).

Cronjob

As the Blogophon will ignore articles with a publishing date set into the future, you may want to build some mechanism for generating your unpublished pages automatically. Here is how:

Get the path to your blog by typing pwd. Then edit your Crontab: crontab -e

Add one of these lines:

# Midnight, daily without log
58 23 * * * cd PATH_TO_YOUR_BLOG && blogophon-generate >/dev/null 2>&1

# Midnight, daily with log
58 23 * * * cd PATH_TO_YOUR_BLOG && blogophon-generate --log >> logs/generate.log 2>&1

# Every 30 minutes, but only one job at a time
*/30 * * * * cd PATH_TO_YOUR_BLOG && flock -xn ~/blogophon.lck -c "blogophon-generate >/dev/null 2>&1"

For more exotic execution times check http://crontab-generator.org/. And keep in mind to check the time zone your crontab will be executed in.

Article deployment

If you like to keep your editing and your HTML files in separate directory or a separate machine, the deployCmd in user/config.json may come in handy. Here are some examples you might find useful:

echo \"Publishing...\" && rsync -az --delete htdocs HOST:PATH_TO_YOUR_BLOG && echo \"Published\" # Sync only published HTML files, keep Blogophon from live server
echo \"Publishing...\" && rsync -az --delete user HOST:PATH_TO_YOUR_BLOG && echo \"Published\"   # Sync only Markdown files, let publishing be done by Cronjob or Daemon

Editor

If you use Sublime Text for editing your Markdown files, consider installing Markdown Extended. It supports YAML frontmatter and code block syntax highlighting in Markdown files. Also Markdown​Live​Preview will show how your Markdown will finally look like.

If you use Microsoft Visual Studio Code you can toggle the built-in Markdown preview by pressing Ctrl + K, followed by a V.

If you use Github Atom you can toggle the built-in Markdown preview by pressing Ctrl + Shift + M.

Migrating to new article structure

In case you want to move articles from the old file structure (user/posts/TITLE.md) to the new file structure (user/posts/TITLE/index.md) here is a little bash script which will do this for all articles which already have an existing folder to move to:

#!/bin/bash

# Exectute in `user/posts`
for DIRECTORY in `find . -type d`; do
  OLD_FILE="$DIRECTORY.md"
  NEW_FILE="$DIRECTORY/index.md"
  if [ -f $OLD_FILE ]; then
    mv $OLD_FILE $NEW_FILE
  fi
done

Server setup

Apache installation

You will find a sample Apache configuration in your user directory after finishing setup.

If you are not allowed to edit the Apache configuration, there is also a .htaccess file in your user directory after finishing setup. This file can be moved to your document root folder htdocs.

nginx installation

You will find a sample nginx configuration in your user directory after finishing setup.

Automatically publish to external services

The Blogophon RSS feed allows for other services to automatically re-publish news about your new articles. This can be used to promote your articles on services like Twitter. This idea is called POSSE (Publish (on your) Own Site, Syndicate Elsewhere).

IFTT

If This Than That handles republishing of RSS feeds to other services. After registering an account just follow these steps:

  1. Click on your user account and select "New applet".
  2. For if [this] select "Feed > New feed item".
  3. Add the feed URL of your blog (e.g. http://www.example.com/posts.rss). You may also choose to use the RSS feed of a special tag (e.g. http://www.example.com/tagged/…/posts.rss).
  4. For then [that] select "Twitter > Post a tweet", or whatever service you want to use.
  5. Allow IFTTT to access the service you selected.
  6. Configure how your blog post's URL and title will be posted to the service you selected.

You may want to deactivate URL shortening in IFTTT's settings.

Slack

Slack offers a plugin to import RSS feeds directly to a Slack channel. Just follow the instructions on installing the RSS app into Slack.

If you are not able to globally install the Blogophon

In certain environments you may not be able to install the Blogophon globally. Thankfully there is a way to locally install the Blogophon.

  1. Run npm init && npm install blogophon --production in a folder you have access to.
  • All commands relating to blogophon may now be called by executing node node_modules/.bin/blogophon
  • All commands relating to blogophon-generate may now be called by executing node node_modules/.bin/blogophon-generate

Configuring your site search

As the Blogophon is a static site generator, there is no built-in site-search functionality. Luckily you can search your site with any regular search engine by submitting a search term, prepended by site:YOURDOMAIN.

The Blogophon uses this method to supply a site-search. When configuring your blog, you will be asked for a search URL. This may be one of the following URLs…

…or if you want to integrate your own search engine you will have to paste the URL of your search engine. Anyway, the search term will be appended to the supplied search engine URL.

This mechanism will automatically generate a search form and a matching opensearch.xml.

Search engine management consoles

To check on how your blog is performing on search engines, register for the appropriate search management consoles:

The steps for setup are identical for all search consoles:

  1. Put verification HTML / XML page into your /htdocs folder.
  2. Submit sitemap located at /sitemap.xml.
  3. Add URL parameter utm_source and mark it as "does not alter site content".

Return to table of contents.