Thicket data repository for the EEG
at main 6.0 kB view raw
1{ 2 "id": "https://www.tunbury.org/2021/05/25/wordpress-to-jekyll-test", 3 "title": "WordPress to Jekyll Test", 4 "link": "https://www.tunbury.org/2021/05/25/wordpress-to-jekyll-test/", 5 "updated": "2021-05-25T12:41:29", 6 "published": "2021-05-25T12:41:29", 7 "summary": "Install the Wordpress plugins UpdraftPlus. Create a new WordPress site and install the UpdraftPlus plugin and restore the database.", 8 "content": "<p>Install the Wordpress plugins <em>UpdraftPlus</em>. Create a new WordPress site and install the <em>UpdraftPlus</em> plugin and restore the database.</p>\n\n<p>Use the following MySQL commands to fix the database</p>\n\n<div><div><pre><code>UPDATE wp_options SET option_value = replace(option_value, 'cccbr.org.uk', 'cccbr.tunbury.org') WHERE option_name = 'home' OR option_name = 'siteurl';\nUPDATE wp_posts SET guid = replace(guid, 'cccbr.org.uk','cccbr.tunbury.org');\nUPDATE wp_posts SET post_content = replace(post_content, 'cccbr.org.uk', 'cccbr.tunbury.org');\nUPDATE wp_postmeta SET meta_value = replace(meta_value,'cccbr.org.uk','cccbr.tunbury.org');\n</code></pre></div></div>\n\n<p>Set user password (mainly to make it different from the original site)</p>\n\n<div><div><pre><code>UPDATE `wp_users` SET `user_pass`= MD5('yourpassword') WHERE `user_login`='melvers';\n</code></pre></div></div>\n\n<p>Install <em>Jekyll Exporter</em> plugin, activate it and then create the export using Tools -&gt; Export to Jekyll.</p>\n\n<p>Create a new Jekyll site by running</p>\n\n<div><div><pre><code>jekyll new c:\\cccbr\n</code></pre></div></div>\n\n<p>Extract <code>jekyll-export.zip</code> into the <code>c:\\cccbr</code> folder but don’t overwrite <code>_config.yml</code></p>\n\n<div><div><pre><code>jekyll serve\n</code></pre></div></div>\n\n<p>Visit <a href=\"http://localhost:4000\">http://localhost:4000</a> to see how it looks.</p>\n\n<div><div><pre><code>$mdFiles = Get-ChildItem . *.md -rec\nforeach ($file in $mdFiles) {\n (Get-Content $file.PSPath) |\n Foreach-Object { $_ -replace \"&amp;#8211;\", \"-\" } |\n Foreach-Object { $_ -replace \"&amp;#038;\", \"&amp;\" } |\n Foreach-Object { $_ -replace \"&amp;#8217;\", \"&amp;apos;\" } |\n Foreach-Object { $_ -replace \"cccbr.tunbury.org/wp-content/uploads/\", \"cccbr.org.uk/wp-content/uploads/\" } |\n Foreach-Object { $_ -replace \"cccbr.tunbury.org/\", \"/\" } |\n Foreach-Object { $_ -replace \"layout: page\", \"layout: single\" } |\n Foreach-Object { $_ -replace \"layout: post\", \"layout: single\" } |\n Set-Content $file.PSPath\n}\n</code></pre></div></div>\n\n<p>Edit <code>GemFile</code> to the new theme by commenting out <code>minima</code> and adding <code>minimal-mistakes</code>:</p>\n\n<div><div><pre><code># gem \"minima\", \"~&gt; 2.5\"\ngem \"minimal-mistakes-jekyll\"\n</code></pre></div></div>\n\n<p>Run <code>bundle</code> in the folder to download the dependancies. Edit <code>_config.yaml</code> and set the theme</p>\n\n<div><div><pre><code>theme: minimal-mistakes-jekyll\n</code></pre></div></div>\n\n<p>Create the top level menu by creating <code>_data/navigation.yml</code>:</p>\n\n<div><div><pre><code>main:\n- title: \"About\"\n url: /about\n- title: \"Bells and Ringing\"\n url: /bellringing\n</code></pre></div></div>\n\n<p>Create secondary menus with the same <code>_data/navigation.yml</code> file such as:</p>\n\n<div><div><pre><code>about:\n- title: About\n children:\n - title: \"About the Council\"\n url: /about\n - title: \"Continuing CCCBR Reforms\"\n url: /about/reforms/\n - title: \"Governance\"\n url: /about/governance/\n</code></pre></div></div>\n\n<p>Then on the appropriate pages set the front matter:</p>\n\n<div><div><pre><code>sidebar:\n nav: \"about\"\ntoc: true\n</code></pre></div></div>\n\n<p>Create a custom skin by duplicating and rename a file in <code>_sass\\minimal-mistakes\\skins</code>. I create <code>cccbr.scss</code> and the in <code>_config.yml</code> apply the theme like this:</p>\n\n<div><div><pre><code>theme: minimal-mistakes-jekyll\nminimal_mistakes_skin: \"cccbr\"\n</code></pre></div></div>\n\n<p>Create a repository on GitHub.</p>\n\n<div><div><pre><code>git init\ngit add .\ngit commit -m \"inital commit\"\ngit remote add origin https://github.com/mtelvers/cccbr.git\ngit push -u origin master\n</code></pre></div></div>\n\n<p>On GitHub under the repo unders Settings \\ Pages publish the site using the master branch.</p>\n\n<p>Changes to make it work on GitHub:</p>\n\n<ol>\n <li>Update <code>Gemfile</code> and then ran <code>bundle</code>.</li>\n <li>Updated all the posts and pages to use the <code>single</code> template.</li>\n <li>Update <code>_config.yml</code> to set baseurl to match Git repository name.</li>\n <li>Update <code>_config.yml</code> to change remote theme.</li>\n</ol>\n\n<p>Remove unwanted front matter tags with this Ruby script</p>\n\n<div><div><pre><code>require \"yaml\"\n\nYAML_FRONT_MATTER_REGEXP = /\\A(---\\s*\\n.*?\\n?)^((---|\\.\\.\\.)\\s*$\\n?)/m\n\nDir.glob('**/*.md', File::FNM_DOTMATCH) do |f|\n puts f\n\n file = File.open(f)\n source = file.read\n file.close\n\n if source =~ YAML_FRONT_MATTER_REGEXP\n data, content = YAML.load($1), Regexp.last_match.post_match\n [\"id\", \"guid\",\n \"ep_tilt_migration\",\n \"classic-editor-remember\",\n \"ssb_old_counts\",\n \"ssb_total_counts\",\n \"ssb_cache_timestamp\",\n \"colormag_page_layout\",\n \"wp_featherlight_disable\",\n \"catchbox-sidebarlayout\",\n \"complete_open_graph\"].each {|x| data.delete(x)}\n\n file = File.open(f, \"w\")\n YAML.dump(data, file)\n file.puts(\"---\", content)\n file.close\n end\nend\n</code></pre></div></div>", 9 "content_type": "html", 10 "author": { 11 "name": "Mark Elvers", 12 "email": "mark.elvers@tunbury.org", 13 "uri": null 14 }, 15 "categories": [ 16 "jekyll", 17 "wordpress" 18 ], 19 "source": "https://www.tunbury.org/atom.xml" 20}