Skip to content

Instantly share code, notes, and snippets.

@kerim
Last active May 12, 2020 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kerim/47ae4e51f5de967a43c5 to your computer and use it in GitHub Desktop.
Save kerim/47ae4e51f5de967a43c5 to your computer and use it in GitHub Desktop.
Notes on migrating Wordpress Blog to GitHub Project Pages using Jekyll and the Hyde theme
I recently migrated ( http://keywords.oxus.net/ ) from my own server to GitHub project pages using Jekyll and the Hyde theme ( https://github.com/poole/hyde ). This Gist documents some of the issues I faced and how I solved the problems.
1. I tried to follow the instructions found on these sites:
http://blog.8thcolor.com/en/2014/05/migrate-from-wordpress/
http://blog.codeinside.eu/2014/09/13/How-We-Moved-From-Wordpress-To-Jekyll-On-Windows/
http://www.nooku.org/blog/2013/03/from-wordpress-to-jekyll/
http://chadfield.org/work/how-i-migrated-wordpress-to-jekyll/
http://www.girliemac.com/blog/2013/12/27/wordpress-to-jekyll/
http://virtuallyhyper.com/2014/05/migrate-from-wordpress-to-jekyll/
http://loyc.net/2014/blogging-on-github.html
http://jekyllrb.com/docs/github-pages/
etc.
I found much of the information contradictory, out of date, or not suited to my particular case.
2. Three things unique to my particular situation were (a) that I was using project pages, not the user page (which I already deployed for my home page http://kerim.oxus.net/ ). (B) that I am using the hyde theme which seems to have its own quirks. And (c) some things about my existing Wordpress setup.
3. The first thing that went wrong was export from Wordpress. Documented that in this discussion thread:
https://github.com/benbalter/wordpress-to-jekyll-exporter/issues/47
However, even after getting the exporter to work, I later realized that it produced some code from my WP theme at the bottom of every page. I did a find-replace to get rid of this. It also set about a dozen of my posts to "layout: default" instead of "layout: post". This took me a long time to notice.
4. I had a lot or problems with getting the site to build under the proper subdomain. Here are the things I had to do:
First, get the _config.yml correct:
url: http://kerim.github.io/
baseurl: /keywords
I did not understand clearly that the URL should be the github page, not the final URL of the site. I also didn't understand that the baseurl should have no trailing slash.
Similarly, in my CNAME records on my DNS provider, I am to point to this root URL (not with the trailing "/keywords" as some documentation seems to incorrectly suggest).
I also had problems with how Hyde created URLs. I had to change the following in the templates:
<link rel="stylesheet" href="{{ site.baseurl }}public/css/poole.css">
to
<link rel="stylesheet" href="{{ site.url }}/public/css/poole.css">
Note the different tag and the addition of a trailing slash. These changes had to be made wherever they could be found.
5. My site used the <!--more--> tag to divide posts. I had to add this to the _config.yml file:
excerpt_separator: <!--more-->
and I had to change {{ contents }} to {{ post.excerpt }} in the index.html file.
(I still have a problem that this tag is showing up in the body of my posts. Not yet sure how to fix that.
6. I had a problem with installing Disqus comments until I added the following to the code they gave me:
/* * * CONFIGURATION VARIABLES * * */
var disqus_shortname = 'keywords';
var disqus_title = '{{ page.title }}';
var disqus_url = 'http://keywords.oxus.net{{ page.url | replace:'/archives','' }}';
/* * * DON'T EDIT BELOW THIS LINE * * */
That is because, although my site seems to use /archive/ in the link structure, disqus does not.
7. Which reminds me that I had to change my permalinks to match what I had in WordPress:
permalink: /archives/:year/:month/:day/:title/
I think that's about it. Once it is all set up it makes sense, but each of these things was a bit of a nightmare to solve individually. For this reason I would not recommend anyone migrate to Jekyll unless they have the patience to figure these kinds of things out on their own.
OUSTANDING ISSUES:
1. RSS feed not showing updates in Feedly
This was fixed by using hard-coded URLs in my atom.xml file. Also, I had to point my Feedburner URL at the new location. (I didn't point the current site to feedburner though, doesn't look like that's being updated?)
2. <!--more--> tags appear in middle of posts
In the post.html template I changed
{{ content }}
to
{{ content | replace: '&lt;!--more--&gt;', ''}}
I also made a "continue reading" link which is conditional on there being a "more" tag:
{% if post.content contains "&lt;!--more--&gt;" %}
{{ post.excerpt }}
<p align="Right"><a href="http://keywords.oxus.net/{{ post.url }}">Continue reading...</a></p>
{% else %}
{{ post.content }}
{% endif %}
EXTRAS
I also integrated my site into prose.io by adding prose specific info to my config file. This is very useful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment