Convert jekyll markdown files to Hugo markdown files with this easy and simple to use Python script https://blog.nuculabs.dev
Find a file
Denis-Cosmin NUTIU 60875fac71 update readme.md
2023-06-03 16:12:00 +03:00
.idea add fix for code blocks 2023-06-02 09:58:20 +03:00
app add config option for RegexHeuristics 2023-06-02 11:12:24 +03:00
.gitignore initial commit 2023-05-29 21:35:38 +03:00
config.yaml update config.yaml 2023-06-02 11:23:27 +03:00
Dockerfile add Dockerfile 2023-06-03 15:13:36 +03:00
LICENSE Initial commit 2023-05-29 20:54:20 +03:00
main.py re-format code 2023-05-31 18:32:42 +03:00
Makefile add pyproject.toml 2023-06-03 16:08:28 +03:00
pyproject.toml add pyproject.toml 2023-06-03 16:08:28 +03:00
readme.md update readme.md 2023-06-03 16:12:00 +03:00
requirements-dev.txt add more dev dependencies 2023-06-03 15:59:02 +03:00
requirements-test.txt initial commit 2023-05-29 21:35:38 +03:00
requirements.txt add config via yaml 2023-05-29 21:58:32 +03:00

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 WorPress to Jekyll to Hugo.

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 .
  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