• Stars
    star
    643
  • Rank 70,000 (Top 2 %)
  • Language
    PHP
  • License
    GNU General Publi...
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Hugo is static site generator written in golang. Wordpress is a tool for remote access to your server ;-) ❗️Contributions welcome!

WordPress to Hugo Exporter

Hugo a static site generator written in GoLang: https://gohugo.io

This repo is based on https://github.com/benbalter/wordpress-to-jekyll-exporter

Hugo Features

One-click WordPress plugin that converts all posts, pages, taxonomies, metadata, and settings to Markdown and YAML which can be dropped into Hugo.

Features

  • Converts all posts, pages, and settings from WordPress for use in Hugo
  • Export what your users see, not what the database stores (runs post content through the_content filter prior to export, allowing third-party plugins to modify the output)
  • Converts all post_content to Markdown Extra (using Markdownify)
  • Converts all post_meta and fields within the wp_posts table to YAML front matter for parsing by Hugo.
  • Exports optionally comments as part of their posts. This features needs to be enabled manually by editing the PHP source code. See file hugo-export.php at line ~40.
  • Export private posts and drafts. They are marked as drafts as well and won't get published with Hugo.
  • Generates a config.yaml with all settings in the wp_options table
  • Outputs a single zip file with config.yaml, pages, and post folder containing .md files for each post in the proper Hugo naming convention.
  • No settings. Just a single click.

Usage with a self hosted WordPress installation

  1. Place plugin in /wp-content/plugins/ folder
  2. Make sure extension=zip.so line is uncommented in your php.ini
  3. Activate plugin in WordPress dashboard
  4. Select Export to Hugo from the Tools menu

Usage at wordpress.com or any other hoster without SSH access

If you cannot install plugins in your wordpress.com instance

(I've never tried it, because not a wp.com user)

  1. Login into the backend.
  2. Create an XML export of the whole blog and download the XML file.
  3. Setup a local WordPress instance on your machine. You need PHP, MySQL or MariaDB and Nginx or Apache or Caddy Server. Alternatively you can install a Docker Compose setup https://github.com/wodby/docker4wordpress
  4. Install this plugin by downloading a zip file of this repo and uploading to WP.
  5. Import the XML export. You should take care that the WordPress version of the export matches the WP version used for the import.
  6. In the WP backend run the Export to Hugo command. If that fails go to the command line run the CLI script with memory_limit=-1, means unlimited memory usage.
  7. Collect the ZIP via download or the CLI script presents you the current name.
  8. Remove WordPress and enjoy Hugo.

Re Docker: It should be very easy to create a Dockerfile containing everything above mentioned for a one time conversion of the XML file to the Hugo format.

If you can install plugins in your wordpress.com instance

  1. Download this repo as a zip file.
  2. Login into the backend.
  3. In the plugin section, go to Add New.
  4. Upload the zip of this repo.
  5. Activate the plugin.
  6. In the WP backend run the Export to Hugo command.
  7. Collect the ZIP via download.
  8. Copy contents of the zip to your Hugo install and enjoy Hugo.

Command-line Usage

If you're having trouble with your web server timing out before the export is complete, or if you just like terminal better, you may enjoy the command-line tool.

It works just like the plugin, but produces the zipfile at /tmp/wp-hugo.zip:

php hugo-export-cli.php

If you want to offer a folder (say a mount point to a huge drive) other than using /tmp in OS, pass it as the first argument to the script:

php hugo-export-cli.php /YOUR_PATH_TO_TMP_FOLDER/

Alternatively, if you have WP-CLI installed, you can run:

wp hugo-export > export.zip

The WP-CLI version will provide greater compatibility for alternate WordPress environments, such as when wp-content isn't in the usual location.

Changelog

2.0.X

Updates the markdownify library, removes lots of unused code, AFAIK. Include GPL.

Many other versions

with tiny fixes

1.6

  • Fix destination against hugo 0.27
  • Fix for working on older PHP
  • Fix memory leak in Converter.php by cut unnessesary
  • updated markdownify
  • entities fix and post image added

1.5

  • Export drafts and private posts
  • Export optionally comments
  • Various changes and fixes

1.4

  • Made license explicit
  • Removed word-wrap from YAML export to prevent breaking permalinks

1.3

  • Use fork of Markdownify rather than external API to convert content from HTML to markdown
  • Better memory utilization for larger sites, props @ghelleks

1.2

  • Commmand-line support, props @ghelleks and @scribu

1.1

  • Use WP_Filesystem for better compatability
  • 1.1.1 - Use heckyeahmarkdown to prevent PHP errors when Markdownify chokes on malformed HTML
  • 1.1.2 - clarify zip.so requirement in readme

1.0

  • Initial Release

License

The project is licensed under the GPLv3 or later

More Repositories

1

Magento-OpCache

OpCache (Zend Optimizer) Control Panel (GUI) for the Magento Backend.
PHP
100
star
2

Magento-FastIndexer

Makes indexing of your Magento store around x times faster! ‼️ Maintainers wanted!
PHP
79
star
3

mailout

mailout - a https://caddyserver.com/ V1 SMTP client email middleware with PGP encryption
Go
73
star
4

Magento-Markdown

Markdown as module for Magento! Replaces the TinyMCE editor. Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).
JavaScript
64
star
5

Magento2-Twig

Twig Template Engine for Magento2
PHP
61
star
6

Anonygento

unmaintained - Anonygento is a Magento module which anonymizes all data especially customer, orders, newsletters.
PHP
54
star
7

blog-cs

My blog at https://cyrillschumacher.com - You may submit pull requests :-)
JavaScript
36
star
8

Magento2-Data-Migration

This script migrates your Magento1 database to Magento2
PHP
34
star
9

Magento-Pace

Magento Pace - Automatic page load progress bar for the backend and frontend
CSS
34
star
10

Magento2-Pace

Magento2 Pace - Automatic page load progress bar for the backend and frontend
CSS
26
star
11

mediamock

Mediamock mocks a media directory for HTTP requests on your development environment. Avoids copying of GBs/TBs/PBs of files to your local machine.
Go
23
star
12

Magento2-Mocks

This Magento2 module provides mock classes when you have physically removed unneeded core modules with dependencies.
PHP
19
star
13

Magento-Hotkeys

Hotkeys aka key board shortcuts for the Magento 1.x backend!
JavaScript
18
star
14

Magento-SecurityBundle

The Magento SecurityBundle provides additional security features for your e-commerce application.
16
star
15

OnixParser

Onix Parser written in GoLang to deal with huge XML file sizes. The ONIX for Books Product Information Message is the international standard for representing and communicating book industry product information in electronic form.
Go
15
star
16

mediamock-magento

Mediamock Magento1 module to disable HDD file access when reading images. File access will be routed to the REST API of the mediamock server
PHP
14
star
17

magento1-pictureperfect

PicturePerfect enables the Magento1 backend user to asynchronously upload multiple photos for different products via drag and drop.
JavaScript
13
star
18

Magento-CmsRestriction

Magento CMS Page Restriction on Customer ID and Group ID basis
PHP
10
star
19

Magento-OptimizedBackendLogin

Sets the autocomplete html form attribute depending on the environment.
HTML
10
star
20

runservicerun

Run Service Run! Starts multiple *http.Server (or other services) and terminates on os.Signal with a graceful shutdown. 🎽
Go
10
star
21

mage2-advanced-rest-permissions

Magento2 Advanced REST permission for usage with AngularJS
PHP
7
star
22

Magento-PGP

Secure emails in Magento via PGP / GPG email encryption. Customers and shop owners can upload their public key and each email sent to their address will be automatically encrypted.
PHP
7
star
23

blog-au

Our public private blog about Down Under. Powered by Hugo #golang static site generator. Hueman Theme from Wordpress has been converted
JavaScript
6
star
24

mediamock-magento2

Magento2 module for mediamock to disable access to the HDD when trying to read an image.
PHP
5
star
25

Magento-Sqrl

Magento Backend and Frontend Login via SQRL https://www.grc.com/sqrl/sqrl.htm
PHP
5
star
26

Magento-ModelView

Magento ModelView - Using a model to simulate a database view. This module contains only abstract classes. getData() is now type safe. __call() disabled.
PHP
4
star
27

Magento2-Markdown

Markdown or Parsedown for Magento2 as template engine
PHP
4
star
28

wanderlust

Wanderlust, the yearning to travel through Google Analytics, Piwik, REST endpoints, sitemap.xml and other sources to warm up the caches of your website.
Go
3
star
29

Magento-Hugo

Magento 1.x module to generate JSON streams for http://gohugo.io
PHP
2
star
30

goverflow

Searches the stack exchange API and tweets the results.
Go
2
star
31

Nodejs-Playground

This is my node.js playground for learning, testing and finding best practice ways. Send me a PULL Request for better ways :-)
CSS
1
star
32

Magento2-RecurringPayments

Recurring Payments for Magento2 @todo ;-)
1
star
33

MageNerator

Magento Module Template Generator. TYPO3, Bootstrap, jQuery and Social Login. Project is deprecated.
PHP
1
star
34

gokvbench

Benchmarks of all GoLang NoSQL stores
Go
1
star
35

csmysql

Fork of github.com/go-sql-driver/mysql to be used without database/sql 🤔
Go
1
star
36

TYPO3Mind

TYPO3Mind is an extension for generating mind mapping files. Mind maps helps you to understand how your whole TYPO3 installation has been setup and what the current running status is. Currently you can only export .mm files which can be imported by FreeMind, Freeplane, XMind, Mindjet, MindManager, etc. TYPO3Mind uses the cool icon from FreeMind. This extension hooks into the tree click menu and in the left pane. The mind map includes many icons and pictures with URIs to your webserver. Each page of the page tree can be configured for itself. Needs TYPO3 4.5 or later, SimpleXML, PHP5. Export via eID is also possible. All Issues and wiki pages are hosted on forge.typo3.org; code will be maintained on both platforms.
PHP
1
star
37

Magento-AsyncSave

DEPRECATED Magento implementation of http://php.net/manual/en/mysqli.query.php to use MYSQLI_ASYNC for inserts and updates
PHP
1
star