3

I have a blog which I want to migrate from Wordpress to Hugo.

The problem is that the blog has a lot of posts which contain code examples, including HTML code.

I'm using Codecolorer as Wordpress plugin, so my posts look something like this (my problem shouldn't be specific to this plugin though):

text 
[cc lang="html"]
<input type="text" value="value">
<input type="text" value="value">
[/cc]
more text [cci]<div>inline code[/cci]

I would like this to be transformed to valid markdown automatically (or at least semi-automatically; if I have to fix some issue manually, that would be fine). Ideally, the export is in a format that I can then directly import to Hugo.

I tried the plugin wordpress-to-hugo-exporter , but it mangles the code completely.

I tried replacing the [cc ...] tags with <code> as well as <xmp> tags in the database before using the exporter plugin, but that resulted in completely empty posts.

I also tried using the Jekyll Exporter (it produces a broken ZIP), exitwp (with and without replaced [cc] tags, but it mangles the code or removes it completely), and wp2md (it removes the code).

Is there a way to easily transform Wordpress posts which contain example code to markdown which can then be imported to Hugo?

  • i think there is no automated system but you can convert your sort code in <code></code> by MYSQL that is easy to do after that you can migrate to hugo – Shiv Singh May 5 '18 at 14:50
  • @ShivSingh You mean the same way I tried replacing it with <xmp>? I actually tried that as well, but it didn't work either. – tim May 5 '18 at 20:39
  • Just export your WP database and open by any editor and do replace it, and it will sure work. – Shiv Singh May 6 '18 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.