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/blogand 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 (withurlpattern), 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
_postsand drafts in_draftsgo in_source/blog, and other pages keep their place. Each page keeps its address, worked out frompermalinkas Jekyll does. Liquid that Dapper can replace (highlightblocks,site.baseurl,relative_url,post_url) is replaced. Folders such asassetsandimagesare copied to the project. - hugo
-
Takes the site's directory. Pages in
contentkeep their place and their address (fromurl,slug, orpermalinksin the Hugo configuration). YAML, TOML and JSON front matter are all read. Files in page bundles are copied with their page,staticis copied into the source directory,aliasesbecome redirects, and theyoutube,vimeoandfigureshortcodes 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.