Code Monkey home page Code Monkey logo

blogger2hugo's Introduction

Blogger2Hugo

Description

Blogger2Hugo is a simple tool to convert Blogger's xml export data into Hugo-friendly markdown format.

The tool is really basic, you just pass it the name of the file you're converting, the directory in which to output the markdown files, and optionally a piece of metadata to add to each of the posts' frontmatter (which must be a single line of valid toml, such as -extra="type = "oldPost"").

Blogger2Hugo outputs the tags, the post title, the published date, and whether or not it's a draft as standard Hugo frontmatter. In addition, the updated date is added, as well as author name and uri, and an additional value of Blogger2Hugo = true (which can be handy for having special handling in your Hugo templates for imported posts).

Finally, the original HTML content is ouput as the main content of the markdown file. Note that no processing is done on the content.. HTML is valid markdown, and it's probably best not to muck with it, so Blogger2Hugo doesn't touch it.

Note that it now supports toml and yaml, but by default it will now use yaml. If you want to support something else, feel free to make a pull request. I set up the code to be pretty easy to update to output other formats.

Getting Started

Dependencies

The latest version of Go should be installed from the Go Install page

Executing program

The program is run from the command line and requires two arguments:

  • xmlfile - The Blogger xml export file
  • targetdir - The directory to output the new Hugo formatted files

Step-by-step

  1. Open up your command line tool (Terminal on macOS)
  2. Navigate to the repository directory
  3. Run go run main.go <xmlfile> <targetdir>

Here's a typical frontmatter output:

---
title: "My cool title"
date: 2014-07-09T17:43:00Z
updated: 2014-07-22T07:11:52Z
tags: ["Hugo", "is", "awesome"]
draft: true
Blogger2Hugo:  true
author: "Joe D'souza"
---

License

This project is licensed under the MIT License - see the LICENSE.md file for details

blogger2hugo's People

Contributors

atulsingh0 avatar natefinch avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.