Skip to content

Instantly share code, notes, and snippets.

Last active May 12, 2020 00:55
Show Gist options
  • 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 ( ) from my own server to GitHub project pages using Jekyll and the Hyde theme ( ). 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:
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 ). (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:
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:
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">
<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:
var disqus_shortname = 'keywords';
var disqus_title = '{{ page.title }}';
var disqus_url = '{{ page.url | replace:'/archives','' }}';
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.
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 }}
{{ 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="{{ post.url }}">Continue reading...</a></p>
{% else %}
{{ post.content }}
{% endif %}
I also integrated my site into 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