Category Archives: Knowledge Base

Force Facebook to show a specific image when linking to your site

With the time shift due to the end of daylight savings coming up soon I faced the same question I face everytime: Will I have more time in the morning or less? Since I’m definitely not the only one always struggling with this I came up with a silly website: kannicheinestundelängerschlafen.de which answers the question “Can I sleep one hour longer?” with a simple “Yes” or “No”.

When someone would post this link on Facebook I wanted to make sure that a meaningful image was assigned to it. But the website does not even contain an image, so what to do?

Just use the Open Graph API and tell Facebook, which image to use – and while we are at it also manipulate the title and description. Add the following lines to the head node in your HTML document:

<head>
	<meta property="og:description" content='This is the description' />
	<meta property="og:title" content='And this is the title' />
	<meta property="og:image" content='http://example.com/image.jpg' />
</head>

P.S.: As I noticed, Facebook still struggles with German umlauts in domain names. Sometimes it would show the url with umlauts and sometimes without. Even explicitly stating the information like

<meta property="og:url" content='http://www.kannicheinestundelängerschlafen.de' />

could not resolve this. I hope this will be fixed soon.

GRUB: Reboot to a specific OS

I have installed Linux parallel to Windows since I still need Windows for image and video editing. Because Linux is my main system, I’ve set the timeout of GRUB to one second so I don’t waste a lot of time but can still change the OS to boot if I am quick enough. But when I reboot from Linux to switch to Windows, I always miss this one second :-). So instead I run the following script, placed under /usr/local/bin:

#!/bin/bash
grub-reboot 2 #The entry's number to start
reboot

To make this work, you have to set the default entry to “saved”:

GRUB 1: In /boot/grub/menu.lst , set default to saved.

GRUB 2:

  1. In /etc/default/grub , set GRUB_DEFAULT=saved
  2. run sudo update-grub