You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Philipa 4921688ff5 improvements for image sync 10 months ago
targets improvements for image sync 10 months ago
.editorconfig init 1 year ago
.gitignore add image upload 10 months ago
Pipfile Prepare for future async improvements 11 months ago
Pipfile.lock Prepare for future async improvements 11 months ago
README.md add image upload 10 months ago
licence init 1 year ago
main.py allow using basic auth for image source urls 10 months ago

README.md

Sync a collection from https://getcockpit.com/ to Wordpress.

Handles the following cases:

change - does it exist create - its new delete - was it deleted

Config

[{
    "enabled": true,
    "language": "en", // defaults to whatever is cockpits default
    "targets": ["wordpress", "devto"],
    "cockpit_url": "https://cockpit.YOURSITE.eu",
    "cockpit_token": "...",
    "cockpit_basicauth": "user:pass",
    "cockpit_collection_posts": "Articles",
    "cockpit_post_date_field": {
      "name": "publishDate",
      "format": "%Y-%m-%d" // or "timestamp" for unix timestamp
    },
    "wordpress": {
      "http_timeout": 5, // if you host wordpress on a slow server you may want to increase the timeout
      "url": "https://YOURWORDPRESSSITE",
      "user": "...",
      "pass": "...", // application spesific password
      "categories": { // optional map cockpit categorie to wp categories
          "somecategory": 1,
          "othercategory": 2
      }
    },
    "devto": {
      "api_key": "...",
      "canonical_base": "https://yoursite.fr" // withot trailing slash (currenlty the slug has to be in the form YYYY/MMM/DDD/your-slug)
    }
  }]

Post Targets

A post target is a site this tool can sync a post to.

Wordpress

Setup categories

In settings.json create a new section "categories" with the categorie name from cockpit as the key and the id for the coresponding categorie in WP as the value. To find the value of categories in WP query curl https://YOURWP.fr/wp-json/wp/v2/categories or look at the table wp_terms in the database.

Markdown supports

Code highligting setup

For code highlighting to work the Pygments CSS file needs to be available on the website. Add this CSS to the website somehow (for example with a plugin) https://raw.githubusercontent.com/rasbt/python_reference/master/tutorials/markdown_syntax_highlighting/codehilite.css

helpful source: https://sebastianraschka.com/Articles/2014_markdown_syntax_color.html

Dev.to

A developer blogging site.

Development

  • Clone this repo
  • pip install pipenv --dev
  • pipenv install
  • Run the code with pipenv run python3 main.py
  • Run tests with pipenv run pytest