Categories
Webmaster

It’s Time to Move: Goodbye Grav, Hello WordPress

Indotechboy – After been like 7 months or so this website had moved from Google Blogger to self hosting and it was using Grav as the Content Management System (CMS), and just two days ago we finally moved to WordPress CMS.

The decision to move from Grav CMS is not an easy one for me personally because of many reasons. First I already comfortable with how Grav works, how easy it is to make a dream website or blog we want using Grav CMS. The second is, how to import all the pages (posts) from Grav to WordPress πŸ˜‚. Meanwhile I am not a professional webmaster nor we have money to hire professional supports to migrate from Grav to WordPress.

The reasons to move from Grav CMS and why WordPress

Wordpress logo

Grav CMS is one of popular choice amongst developers to make a fast and easy to setup website with very little server requirements. All we need to run Grav-based website is only a working web server (Apache, Nginx, LiteSpeed, Lightly, IIS, etc) with PHP 7.1.3+. That’s it, we don’t even need a database because Grav is a flat file CMS, means it stores all files that needed in files in the server file directory. Grav is also one of popular CMS project in Github with high stars.

Grav is not a bad CMS. Even, I consider Grav CMS as my dream CMS. I was started Indotechboy from Google Blogger. After my knowledge in website management is slowly growing, I feel there is a lot I want to do that can only be achieved in a self hosting environtment. After compared many CMSes, I felt Grav CMS is the right choice because I could move to self hosting environtment (with no prfessional webmaster in mind), while keep my head in low stress because I did not need to maintain many complex server side things because Grav is a flat file CMS 😁.

But as time slowly passed by, I feel that I became slowly writing less articles to post in this blog. I originally am a Blogger and as time passes by I know a little of webmaster technical knowledge, I ended up spent more times in backend rather than focus to write content. When I was using Grav, I spent many hours to creating my own plugins, developing my own theme, fixing code errors, etc and it was even a decent task to only published a “blog post” where I need to solved it to upload the post directly using FTP (especially when using mobile device). This was the reason why I want to move to a more easy to use CMS for content creator, and after experimenting many CMSes the choice was finally fall back to the most popular web CMS in the world: Worpress.

Did I said “fall back”? Yes, at first I was really avoided to using WordPress πŸ˜‚. The culprit was thanks to my wobble personality after I read on the internet of “how WordPress is really bad” πŸ˜‚. But in the end I decided to brace myself to use WordPress in principles:

  • There is no such perfect CMS in the world.
  • I shouldn’t worry over things I can’t see with my own eyes, because it will held me to take a step further.
  • “Life is not complex. We are complex. Life is simple, and the simple thing, is the right thing” – Oscar J. Wilde.

And so, here we are become a member of WordPress big family 😁. After this site has succesfully migrated, I don’t know why my worries of “how WordPress is really bad” I read on the Internet is kind like dissappears every time I see the beautiful dashboard, elegant themes, lots of plugins, vibrant community, and how easy and intuitive it is WordPress for a content creators. Now it’s time to back to focus on writing content rather than in the backend, YEAHH!!! I AM READY πŸ™Œβœ’!!!

Migrating Pages from Grav CMS to WordPress

Migrating the pages into WordPress blog posts is another thing to handle for me. Because I am not a professional webmaster / developer, I was quite having a hard time how to migrate the flat file pages (not to mention it is written in markdown format) to WordPress.

But in the end I decide to gather all the pages I want to migrate into WordPress export file. For me personally this is thanks to how easy Grav CMS works. So here are how I migrate all the pages into WordPress:

Materials:

  • Sample WordPress export file.

Steps:

  1. Install Feed plugin in Grav.
  2. Enable the “Json Feed” support.
  3. Modify the Json Feed template by creating a feed.json.twig file in /user/themes/mycurrenttheme/templates directory.
  4. Modify the feed.json.twig file so it can output exactly the same like the sample WordPress export theme (you can check the code below).
  5. Change the feed limit to maximum (1000) so it can output all pages (I was currently had 300 pages I want to import at that time).
  6. Finally “download” the export result by visitting the page containing your pages collection you want to import by adding “.json” to the url, e.g. mysite.com/mypages.json. If you are having hard time to do this from your browser, you can easily download a web page (json file in this case) using download manager.
  7. Change the import file extension you have saved to “xml”.
  8. Go to your WordPress import tools and import from the file.
{% set collection = collection|default(page.collection) %}

<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->

<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<!-- 4. Activate & Run Importer. -->
<!-- 5. Upload this file using the form provided on that page. -->
<!-- 6. You will first be asked to map the authors in this export file to users -->
<!--    on the site. For each author, you may choose to map to an -->
<!--    existing user on the site or to create a new user. -->
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
<!--    contained in this file into your site. -->

	<!-- generator="WordPress/5.3" created="2019-11-25 13:27" -->
<rss version="2.0"
	xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:wp="http://wordpress.org/export/1.2/"
>

<channel>
	<title>Indotechboy</title>
	<link>https://indotechboy.com</link>
	<description>Just another WordPress site</description>
	<pubDate>Mon, 25 Nov 2019 13:27:26 +0000</pubDate>
	<language>en-US</language>
	<wp:wxr_version>1.2</wp:wxr_version>
	<wp:base_site_url>https://indotechboy.com</wp:base_site_url>
	<wp:base_blog_url>https://indotechboy.com</wp:base_blog_url>

		<wp:author><wp:author_id>1</wp:author_id><wp:author_login><![CDATA[admin]]></wp:author_login><wp:author_email><![CDATA[admin@gmail.com]]></wp:author_email><wp:author_display_name><![CDATA[admin]]></wp:author_display_name><wp:author_first_name><![CDATA[]]></wp:author_first_name><wp:author_last_name><![CDATA[]]></wp:author_last_name></wp:author>

				
	<generator>https://wordpress.org/?v=5.3</generator>
        {% for item in collection %}
		<item>
		<title>{{ item.title }}</title>
		<pubDate>{{ item.date|date('D, d M Y H:i:s') }} +0000</pubDate>
		<dc:creator><![CDATA[author]]></dc:creator>
		<description></description>
		<content:encoded><![CDATA[{{ item.content }}]]></content:encoded>
		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
		<wp:post_date><![CDATA[{{ item.date|date('Y-m-d H:i:s') }}]]></wp:post_date>
		<wp:post_date_gmt><![CDATA[{{ item.date|date('Y-m-d H:i:s') }}]]></wp:post_date_gmt>
		<wp:comment_status><![CDATA[open]]></wp:comment_status>
		<wp:ping_status><![CDATA[open]]></wp:ping_status>
		<wp:status><![CDATA[publish]]></wp:status>
		<wp:post_parent>0</wp:post_parent>
		<wp:menu_order>0</wp:menu_order>
		<wp:post_type><![CDATA[post]]></wp:post_type>
		<wp:post_password><![CDATA[]]></wp:post_password>
		<wp:is_sticky>0</wp:is_sticky>
		 {% if item.taxonomy.tag is iterable %}
		  {% for tag in item.taxonomy.tag %}
		    <category domain="post_tag" nicename="{{ tag|lower|replace({' ':'-'}) }}"><![CDATA[{{ tag|lower }}]]></category>
		  {% endfor %}
		 {% else %}
		   <category domain="post_tag" nicename="{{ item.taxonomy.tag|lower|replace({' ':'-'}) }}"><![CDATA[{{ item.taxonomy.tag|lower }}]]></category>
		 {% endif %}
		 <category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
						</item>
		{% endfor %}
				</channel>
</rss>
	

By Daryadi Sarumpaet

Webmaster Assistant and Editor at Indotechboy.com.

Daryadi enjoying himself listening J-pop genre music and playing games, especially old school games. Sometimes he also found watching anime and reading manga are interesting when his fellow author recommend him some good titles.

Leave a Reply

Your email address will not be published. Required fields are marked *