Register now and start sharing your code snippets.

How to optimize your MephistoBlog powered site's search engine ranking (SEO for MephistoBlog)

Plain Text posted 17 days ago by christian

At Aktagon we use MephistoBlog as CMS , and I couldn’t find any information on how to SEO optimize MephistoBlog on Google, so I’m sharing my notes here.

This tip shows you how to make your pages more search engine friendly.

First, add the title tag, plus the meta description and keywords tags to your layout’s Liquid template , as shown here:

   1  <meta name="description" content="{% if article %} {{ article.excerpt }}  {% else %} YOUR DEFAULT SITE DESCRIPTION {% endif %}" />
   2  	<meta name="keywords" content="{% if article %} {% for tag in article.tags %}{{ tag }}, {% endfor %} {% endif %} YOUR DEFAULT KEYWORDS" />
   3  	<title>{% if article %} {{ article.title }} &raquo; {{ site.title }} {% else %} {{ site.title }} &raquo; {{ site.subtitle }} {% endif %}</title>

Remember to update the default description and keywords in the meta tags’ body.

Now, whenever you publish an article, simply add an excerpt and some tags to it. The excerpt is used as the meta description and the article’s tags as the meta keywords, both make Google a bit happier, but the description is by far the more important.

Tagged seo, mephistoblog, meta, google, search, keywords

"updating paths is incompatible with switching branches/forcing" error when using git branches with Vlad

Plain Text posted about 1 month ago by christian

I ended up writing this snippet after I found out that deploying a git branch with vlad wasn’t as easy as it should’ve been…

I assumed the Vlad documentation was right, so I put the branch name in the revision variable (located in config/deploy.rb):

   1  set :revision,              'branch_name'

But then I got this error when executing rake vlad:deploy:

   1  git checkout: updating paths is incompatible with switching branches/forcing
   2  Did you intend to checkout 'branch_name' which can not be resolved as commit?

I managed to solve the problem by using the SHA1 hash of the branch instead of the branch name, but that only worked for the current revision:

   1  set :revision,              'd34360870be6536992e6d45bb0aa72eca31e14443'

So after some googling I found this post at scie.nti.st, which made my day because it has the following examples of how to deploy tags and branches with git and Vlad:

   1  # Deploy the latest code, this the default
   2  set :revision, "HEAD" 
   3  
   4  # Deploy branch "origin/branch_name"
   5  set :revision, "origin/branch_name"
   6   
   7  # Deploy tag "1.0"
   8  set :revision, "1.0"

Note that you have to push the branch to the remote server before running rake vlad:deploy:

   1  git push origin branch_name

Tagged vlad, git, branch, deploy, revisions, tags

Mephisto title...

Plain Text posted about 1 month ago by christian

   1  <title>{% if article %} {{ article.title }} &raquo; {{ site.title }} {% else %} {{ site.title }} &raquo; {{ site.subtitle }} {% endif %}</title>

Tagged mephisto, title

Awstats LogFormat configuration for nginx LogFormat

Plain Text posted about 1 month ago by christian

This is my nginx LogFormat configuration:

   1  log_format main '$remote_addr - $remote_user [$time_local] $status '
   2                      '"$request" $body_bytes_sent "$http_referer" '
   3                      '"$http_user_agent" "http_x_forwarded_for"';

And this is my Awstats LogFormat configuration:

   1  LogFormat = "%host - %host_r %time1 %code %methodurl %bytesd %refererquot %uaquot %otherquot"

Tagged awstats, nginx, logformat, configuration

Sphinx configuration file template

Plain Text posted 4 months ago by christian

   1  source feed_items
   2  {
   3          type                    = mysql
   4  
   5          sql_host                = 127.0.0.1
   6          sql_user                = root
   7          sql_pass                =
   8          sql_db                  = xxx_production
   9          sql_port                = 3306  # optional, default is 3306
  10          sql_sock                = /var/run/mysqld/mysqld.sock
  11  
  12          sql_query_pre           = SET NAMES utf8
  13          #sql_query_pre          = SET SESSION query_cache_type=OFF
  14  
  15  	# Unique ID should be first column
  16          sql_query               = \
  17                  SELECT i.id, i.title, i.link, f.link, f.title FROM feed_items i LEFT JOIN feeds f ON f.id = i.feed_id
  18  }
  19  
  20  
  21  index feed_items
  22  {
  23          source                  = feed_items
  24          path                    = /var/sphinx/xxx
  25          morphology              = libstemmer_sv
  26          charset_type            = utf-8
  27  }
  28  
  29  
  30  indexer
  31  {
  32          mem_limit               = 32M
  33  }
  34  
  35  searchd
  36  {
  37          address                 = 127.0.0.1
  38          port                    = 3312
  39          log                     = /var/log/sphinx/searchd.log
  40          query_log               = /var/log/sphinx/query.log
  41          pid_file                = /var/log/searchd.pid
  42          max_matches             = 1000
  43  }
  44  

Tagged sphinx, template, configuration