Sync your Medium posts to a Webflow CMS collection.
Add this line to your application's Gemfile:
gem 'medium_to_webflow'
Or install it yourself as:
$ gem install medium_to_webflow
There are two ways to configure and use the gem:
First, generate a sample configuration file:
$ medium_to_webflow init
# Creates config/medium_to_webflow.rb with environment variables support
# Or specify a custom path
$ medium_to_webflow init --path=./config.rb
The configuration file will look like this:
MediumToWebflow.configure do |config|
# Required settings
config.medium_username = ENV.fetch("MEDIUM_USERNAME", nil)
config.webflow_api_token = ENV.fetch("WEBFLOW_API_TOKEN", nil)
config.webflow_collection_id = ENV.fetch("WEBFLOW_COLLECTION_ID", nil)
# Field mappings from Medium post attributes to Webflow field names
config.field_mappings = {
# Required mappings
title: "name", # Maps to Webflow's name field
guid: "slug", # Maps to Webflow's slug field
# Optional mappings (customize based on your collection)
url: "source-url", # Maps to a custom field
published_at: "date", # Maps to a date field
author: "author", # Maps to an author field
image_url: "image", # Maps to an image field (converted to { url: value })
category: "category" # Maps to a category field
}
end
Then run the sync:
$ medium_to_webflow sync -c config/medium_to_webflow.rb
You can also run the sync directly with command line options:
$ medium_to_webflow sync \
--medium-username=your-username \
--webflow-api-token=your-token \
--webflow-collection-id=your-collection-id \
--field-mappings=title:name,guid:slug,url:medium-url
$ medium_to_webflow sync [options]
-u, --medium-username=USERNAME Medium username (without the @ symbol)
-t, --webflow-api-token=TOKEN Webflow API token with CMS permissions
-l, --webflow-collection-id=ID The ID of the Webflow collection where posts will be imported
-m, --field-mappings=MAPPINGS Map Medium post fields to Webflow collection fields
-v, --verbose Enable verbose logging
-f, --force-update Force update existing posts (default: false)
-c, --config=PATH Path to a Ruby config file
-h, --help Show this help message
The verbose flag (-v
) will output detailed debugging information during the sync process, which can be helpful for troubleshooting issues.
The --force-update
flag controls how existing posts are handled:
- When set to false (default), the sync will skip posts that already exist in Webflow
- When true, existing posts will be updated with the latest content from Medium
When configuring field mappings, you can use any of these Medium post attributes:
title
: The post titleurl
: The Medium post URLpublished_at
: Publication dateauthor
: Post authorimage_url
: Featured image URLcategory
: Post categoryguid
: The post's unique identifier
Your field mappings must include these Webflow fields:
name
: The item name in Webflowslug
: The URL slug in Webflow
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests.
Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.