NAME

App::Dapper::Import - Bring a site in from WordPress, Jekyll, Hugo or Medium.

DESCRIPTION

dapper import copies the writing from another site into the source directory of a Dapper project, so you can move over without retyping anything. Run it in a Dapper project (dapper init first):

$ dapper import wordpress export.xml
$ dapper import jekyll ../old-site
$ dapper import hugo ../old-site
$ dapper import medium medium-export.zip
$ dapper import jekyll ../old-site --dry-run    # show what would happen
$ dapper import wordpress export.xml --to posts # posts go in _source/posts
wordpress

Takes the export file from Tools, Export in WordPress. Posts go in _source/blog and pages in _source, as HTML, with their title, date, categories, tags and excerpt. Drafts, pending and private posts are imported as drafts. Each page keeps its old address (with urlpattern), so links to it keep working. Videos from [embed] and YouTube or Vimeo addresses on a line of their own become embedded videos, and [caption] becomes a figure.

jekyll

Takes the site's directory. Posts in _posts and drafts in _drafts go in _source/blog, and other pages keep their place. Each page keeps its address, worked out from permalink as Jekyll does. Liquid that Dapper can replace (highlight blocks, site.baseurl, relative_url, post_url) is replaced. Folders such as assets and images are copied to the project.

hugo

Takes the site's directory. Pages in content keep their place and their address (from url, slug, or permalinks in the Hugo configuration). YAML, TOML and JSON front matter are all read. Files in page bundles are copied with their page, static is copied into the source directory, aliases become redirects, and the youtube, vimeo and figure shortcodes become components.

medium

Takes the export from Medium's settings (the zip file, or the folder it unzips to). Each story becomes an HTML page in _source/blog, with Medium's classes removed. Unpublished stories are imported as drafts.

Nothing that is already in the source directory is overwritten. Redirects are added to _data/redirects.yml. Afterwards, dapper import lists what it couldn't convert (such as shortcodes and Liquid tags it doesn't know) for you to look at, and dapper check finds any links that need fixing.

kinds

Returns the kinds of site that can be imported.

run

Takes a Dapper object, the kind of site (wordpress, jekyll, hugo or medium), the file or directory to import, and options: to (the directory under the source directory for posts, default blog) and dry_run. Imports the site and returns a summary as a hash reference.

toml

Takes TOML text and returns it as a hash reference. It reads what front matter and Hugo's settings use: keys (including dotted keys) and values (text with escapes, multi-line text, numbers, true and false, dates, and lists, including lists of lists), tables ([params]) and comments. Numbers and dates are kept as they are written. Inline tables are kept as text, and an array of tables ([[menu]]) is read as one table.