Contributors: litefeel
Tags: github, git, version control, content, collaboration, publishing, writing
Donate link: https://www.paypal.me/litefeel
Requires at least: 3.9
Tested up to: 5.4
Stable tag: 1.11
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
A WordPress plugin to allow you writing on GitHub (or Jekyll site).
A WordPress plugin to allow you writing on GitHub (or Jekyll site).
Some code for this plugin comes from Wordpress GitHub Sync, thanks.
Ever wish you could collaboratively author content for your WordPress site (or expose change history publicly and accept pull requests from your readers)?
Well, now you can! Introducing Writing On GitHub!
The sync action is based on two hooks:
save_post
hook which pushes content to GitHubpush
webhook (outbound API call)writing-on-github.zip
from the WordPress plugins repository.writing-on-github.zip
from your computerwriting-on-github.zip
writing-on-github
directory to your computerwriting-on-github
directory to the /wp-content/plugins/
directorypublic_repo
scope. If you'd prefer not to use your account, you can create another GitHub account for this.application/json
as the content type. To set up a webhook on GitHub, head over to the Settings page of your repository, and click on Webhooks & services. After that, click on Add webhook.Export to GitHub
Writing On GitHub exports all posts as .md
files for better display on GitHub, but all content is exported and imported as its original HTML. To enable writing, importing, and exporting in Markdown, please install and enable WP-Markdown, and Writing On GitHub will use it to convert your posts to and from Markdown.
You can also activate the Markdown module from Jetpack or the standalone JP Markdown to save in Markdown and export that version to GitHub.
.
├── _pages
| └── 2007-10-29-some-pages.md
├── _posts
| └── 2009-04-26-some-posts.md
└── images
└── some-images # copy all files (include subdirectory) to wordpress
Writing On GitHub is also capable of importing posts directly from GitHub, without creating them in WordPress before hand. In order to have your post imported into GitHub, add this YAML Frontmatter to the top of your .md document:
---
post_title: 'Post Title'
post_name: 'this is post name'
post_date: '2018-03-07 15:21:26'
layout: post_type_probably_post
published: true_or_false
author: author_name
tags:
- tag_a
- tag_b
categories:
- category_a
- category_b
---
Post goes here.
and fill it out with the data related to the post you're writing. Save the post and commit it directly to the repository. After the post is added to WordPress, an additional commit will be added to the repository, updating the new post with the new information from the database.
Note that Writing On GitHub will import posts from the master
branch by default. Once set, do not change it.
If Writing On GitHub cannot find the author for a given import, it will fallback to the default user as set on the settings page. Make sure you set this user before you begin importing posts from GitHub. Without it set, Writing On GitHub will default to no user being set for the author as well as unknown-author revisions.
Found a bug? Want to take a stab at one of the open issues? We'd love your help!
See the contributing documentation for details.