Work
with us

Tell us about your idea
and we will find a way
to make it happen.

Get estimate

Join our awesome team

Check offers

People who know and use Octopress love it to death, and consider it the “elitist’s way to blog”. I agree that it’s a good, robust and stable solution, but it can be hard to master for a beginner. That is mostly because the guides assume you have at least some experience with ‘teh internetz’ – so if you go here you’re immediately bombarded with deployment options, technical terms and slang. SSH? Bless you. Rsync? A lovely day to you too, sir. Also, unless you’ve had experience with Markdown/Jekyll, writing your first blog post can be a bit confusing since there are no examples to be found. That’s why in this little article, I’ll try to go over some of the basics, as well as solve a few problems that “raw” Octopress has trouble with.

Surely Superfluous Hacks

Octopress offers a really easy way to deploy to your own hosted server via the SecureShell protocol (known as ssh). Unfortunately, not all hosting providers offer ssh access to your directory. Then the only remaining option is to change the server completely (which is complete overkill, if you ask me), resign from Octopress in favour of a different engine… or use a few lines of clever code to set up an easy deployment via the File Transfer Protocol. First, we need to alter the Rakefile, located in the root folder of our blogging app.

## -- LFTP Deploy config -- ##
ftp_user       = "login"
ftp_password   = "password"
ftp_server     = "server"
ftp_target     = "/remote/path/to/blog"
deploy_default = "lftp"

## -- New deployment task -- ##
desc "LFTP blog deployment method"
task :lftp do
  puts "Beggining"
  ok_failed system("lftp -e 'mirror -R --ignore-time --delete -v #{public_dir} #{ftp_target}; bye' -u #{ftp_user} #{ftp_server}")
end

Now once you run rake deploy, lftp will ask you for your password and perform all that is needed. The --ignore-time option ignores files that haven’t changed and were just regenerated by Octopress rake commands, while --delete will clean the server of any files that you have deleted since the last deployment.

Marksmen of Markdown

Markdown gives you a lot of possibilities. Unfortunately, the octopress home page offers very little in the way of documentations. So I’ll be doing a quick rundown on some of the more curious syntax.

Images

The formula is: ![alternative-text](img-url "Title")

In your config.rb file there is a line http_images_path – this will be the path you use to post your own images. In our example the setup is as follows:

http_images_path = "/blog/images"

And the necessary code, is, respectively:

![Cute local image of a kitten](/blog/images/cute-kitten-playing.jpg "Our local image of a kitten")

![Cute external image of a kitten](http://placekitten.com/g/200/300 "An external image of a kitten")

Output:

Note that the “Title” part is optional.

If you want more control over your image, there is always the imagetag plugin:

<img class="[class names]" src="/path/to/image" title="[width] [height] [title text [alt text]]" >

Image pathing works just like in the previous example.

# Image comes from Placekitten.

Codeblocks

There are two (very similar) ways to go about displaying code blocks:

  • The backtick notation
```[language] [title] [url] [link text] [linenos:false] [start:#] [mark:#,#-#]
  INSERT CODE HERE
```
  • The codeblock syntax
{%codeblock [lang:language] [title] [url] [link text] [start:#] [mark:#,#-#] [linenos:false]} 
INSERT CODE HERE 
{%endcodeblock%}

Both of them take almost the same parameters:

  • [lang]/[lang:language] – The language syntax to be highlighted
  • title – Filename, title of example or any way you wish to title your code block
  • url – If you can link to a page that let’s the viewer display/download your reference code
  • link text – Display text for above link
  • start:# – The beggining line number (Useful if you have a lot of code you want to cover in different blocks)
  • mark:#,#-# – Marks the line/lines of code you want to highlight as important
  • linenos:false – Disables line numbering

Useful tip: if you want to show some Markdown code directly from Octopress (like above), you can enclose it using {%raw/endraw%} tags.

Useful text styling tips

You can *emphasise* in _two ways_ using italics.
You can also use **strong emphasis**, __also in two ways__ using a bold font.
You can combine the two **_if need be_**.
An easy way for crossing out ~~whatever you want~~.

Output:

You can emphasise in two ways using italics.

You can also use strong emphasisalso in two ways using a bold font.

You can combine the two if need be.

An easy way for crossing out whatever you want.

Conclusion

While Octopress can be infuriating to set up and learn, once you do, you feel all the more proud. It gives a feeling of accomplishment, and you can say “I wrote this blog myself” and have something more than just the articles on your mind.

Post tags: