Skip to main content

Python library for converting jekyll md files to Hugo.

Project description

Jekyll to Hugo Converter

Jekyll to Hugo Converter is a simple tool to convert Jekyll posts to Hugo posts.

I've used this tool to convert my blog from WordPress to Jekyll and finally to Hugo.

The tool has the following features:

  • Batch conversion.
  • Post header fields drop/ignore.
  • Links rewrite. (Search and Replace)
  • Author name rewrite.

It was written in a way that is easy to extend, while I wrote it for my own personal use, I hope you'll find some use for it as well.

Note: This tool is not perfect, it will not convert everything. If you find a bug, please open a PR.

Table of Contents

Usage

PiPy or Pipx

If you have Python installed, you can use the following commands:

pip install jekyll-to-hugo
jekyll-to-hugo

You will need to create a config.yaml file in the current directory. See example here.

pipx is a tool to install Python CLI tools in isolated environments

Python From Source

If you have Python installed, you can use the following commands:

pip install -r requirements.txt
python3 jekyll-to-hugo.py <jekyll_post_path> <hugo_post_path>

To change the config, edit config.yaml.

The configuration file path can be configured with the CONFIG_PATH environment variable.

Docker

If you don't have Python installed, you can use Docker:

  1. Build the image.
docker build -t jekyll-to-hugo -f ./docker/Dockerfile .
  1. Run the image. You will need to mount the following directories: config file, Jekyll posts directory, Hugo posts directory.
docker run -it --rm -v $(pwd):/app jekyll-to-hugo

Configuration

The configuration file is a YAML file. See example here. The configuration file path can be configured with the CONFIG_PATH environment variable.

Example Configuration

logging_level: "INFO"
source_path: "/Users/dnutiu/PycharmProjects/jekyll-to-hugo/my_test_data/_posts"
output_path: "/Users/dnutiu/NucuLabsProjects/NucuLabsDevBlog/content/posts"
converter: "wordpress_markdown_converter"
converter_options:
  enable_regex_heuristics: true
  author_rewrite: "Denis Nuțiu"
  links_rewrite:
    - source: "http://localhost/"
      target: "/"
    - source: "https://nuculabs.wordpress.com/"
      target: "https://nuculabs.dev/posts/"
    - source: "https://twitter.com/metonymyqt"
      target: "https://twitter.com/nuculabs"
  header_fields_drop:
    - restapi_import_id
    - original_post_id
    - timeline_notification
    - wordads_ufa
    - spay_email
    - amp_status
    - advanced_seo_description
    - publicize_twitter_user

License

This project is licensed under the GPL-3.0 license - see the LICENSE file for details.


Made with ❤️ by NucuLabs.dev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jekyll_to_hugo-0.0.9.tar.gz (138.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jekyll_to_hugo-0.0.9-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file jekyll_to_hugo-0.0.9.tar.gz.

File metadata

  • Download URL: jekyll_to_hugo-0.0.9.tar.gz
  • Upload date:
  • Size: 138.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for jekyll_to_hugo-0.0.9.tar.gz
Algorithm Hash digest
SHA256 6eee34a2f2f94958de593e29be119fb4ac785494ee7a080d9cabd4f8f54a1866
MD5 f4e2a5980eed00166da0a9d3c7befa35
BLAKE2b-256 46f039255b8b03e8809fb544c71863308bf3bd03be843bedf069807574b28466

See more details on using hashes here.

File details

Details for the file jekyll_to_hugo-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for jekyll_to_hugo-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 0d2817f24a4eb1329bd58a9c7f624581c973918b00fbd86700d7e01a5d13ab19
MD5 f12de7cb54f1d744f4a09db3813bdf66
BLAKE2b-256 11d85cc709a800079067c259e08f36e4bd958f95a9cffa95a8cf8c26f25337a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page