Skip to content

Commit

Permalink
v1.0.1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vaakash committed Aug 15, 2020
1 parent 2243f0d commit b7c8940
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 19 deletions.
6 changes: 3 additions & 3 deletions git-it-write.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
/*
Plugin Name: Git it Write
Plugin URI: https://www.aakashweb.com/
Plugin URI: https://www.aakashweb.com/wordpress-plugins/git-it-write/
Description: Publish markdown files present in a Github repository as posts to WordPress automatically
Author: Aakash Chakravarthy
Author URI: https://www.aakashweb.com/
Version: 1.0
Version: 1.0.1
*/

define( 'GIW_VERSION', '1.0' );
define( 'GIW_VERSION', '1.0.1' );
define( 'GIW_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
define( 'GIW_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );

Expand Down
2 changes: 1 addition & 1 deletion includes/webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static function init(){

add_action( 'rest_api_init', function () {
register_rest_route( 'giw/v1', '/publish', array(
'methods' => 'GET',
'methods' => 'POST',
'callback' => array( __CLASS__, 'handle_webhook'),
));
});
Expand Down
102 changes: 102 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Git it Write

Git it Write is WordPress plugin which allows to publish the markdown files present in a Github repository to your WordPress site. So with this plugin, whenever the files are added, updated in the repository the WordPress post will be added, updated accordingly.

This allows people to collaborate with the post, share edits and suggestions in Github which when pulled the WordPress post will be updated automatically.

If a repository has files in the below structure,

docs\
guide\
introduction.md
getting-started.md
help\
faq.md

Then below posts will be created like below (if permalinks are configured and the post type supports "hierarchy" i.e creating posts level by level (example: pages))


https:\\example.com\docs\guide\introduction\
https:\\example.com\docs\guide\getting-started\
https:\\example.com\help\faq\

### What is the use of this plugin ?

* Publish posts using the files in your Github repository.
* Write your posts in Markdown format.
* Write your posts on your desktop application (Notepad++, Sublime Text, Visual studio code).
* Collaborate, involve communities on the files in Github and publish them on WordPress.
* All the advantages of Git and it's version management system.

### Some use cases

* Can be used for documentation posts, FAQs, Wikis etc.
* Write blog posts.
* Any articles which may need community involvement.

### Features

* Markdown will be processed and post will be published as HTML.
* Images used in the source file will be uploaded to WordPress.
* Relative links are supported.
* Set post properties like post status, title, order, category, tags etc, in the source file itself.
* Webhook support (whenever repository is changed, it updates the plugin to pull the latest changes and publish the posts)
* Add multiple repositories.
* Publish to any post type.
* Posts are published in hierarchial manner if they are under folders. Example: a file dir1/hello.md will be posted as dir1/hello/ in WordPress if the post type supports hierarchy.

### Note

* Only Markdown files will be pulled and published right now
* Posts won't be deleted when it's source file is deleted on Github.
* It is preferred to have a permalink structure.
* It is preferred to select a post type which supports hierarchy.
* Images have to present only in `_images` folder in the repository root. Markdown files have to relatively use them in the file.

### Recommendation

It is recommended that a permalink structure is enabled in the WordPress site so that, if you have file under `docs\reference\my-post.md` then a post is published like `https://example.com/docs/reference/my-post/`. This will be the result when post type has hierarchy support. They will be posted level by level for every folder in the repository. The folder's post will be taken from the `index.md` file if exists under that folder.

### Using the plugin

1. Have a Github repository where all the source files (markdown files) are maintained (organized in folders if needed the exact structure)
1. In the plugin settings page, click add a new repository.
1. Enter the details of the repository to pull the posts from and under what post type to publish them.
1. Save the settings
1. Click "Pull the posts" and then "Pull only" changes. This will publish posts for all the markdown files.
1. To automatically update posts whenever repository is updated, configure webhook as mentioned in the settings page.

### Links

* [FAQ](https://www.aakashweb.com/docs/git-it-write/)
* [Support forum/Report bugs](https://www.aakashweb.com/forum/)
* [Donate](https://www.paypal.me/vaakash/)


## Installation

1. Extract the zipped file and upload the folder `git-it-write` to to `/wp-content/plugins/` directory.
1. Activate the plugin through the `Plugins` menu in WordPress.
1. Open the admin page from the "Git it Write" link under the settings menu.



## Frequently Asked Questions

Please visit the [plugin documentation page](https://www.aakashweb.com/docs/git-it-write/) for complete list of FAQs.

### When a post is edited in WordPress will that update the file in the Github repository ?

No. This plugin won't sync post content. It is a one way update. Only changes made to the Github repository will update the posts and not otherwise.

### What all files in the repository will be published ?

All markdown files will be published as posts.

### What are not published ?

Any folder/file starting with `_` (underscore), `.` (dot) won't be considered for publishing.

### Can I pull posts from a specific folder in the repository ?

Yes, if you want to pull posts from the a folder in a repository then you can specify it in the plugin's repository settings page. For example, if a repository has a folder `website\main\docs` and if you want to pull only from docs folder, then you can specify `website\main\docs` in the plugin settings.
31 changes: 16 additions & 15 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Git it Write
# Git it Write - Write posts from Github
Contributors: vaakash
Author URI: https://www.aakashweb.com/
Plugin URI: https://www.aakashweb.com/wordpress-plugins/git-it-write/
Expand All @@ -8,7 +8,7 @@ License: GPLv2 or later
Requires PHP: 5.3
Requires at least: 4.4
Tested up to: 5.5
Stable tag: 1.0
Stable tag: 1.0.1

Publish markdown files present in a Github repository as posts to WordPress automatically

Expand All @@ -22,22 +22,19 @@ This allows people to collaborate with the post, share edits and suggestions in

If a repository has files in the below structure,

```
docs\
guide\
introduction.md
getting-started.md
help\
faq.md
```
docs\
guide\
introduction.md
getting-started.md
help\
faq.md

Then below posts will be created like below (if permalinks are configured and the post type supports "hierarchy" i.e creating posts level by level (example: pages))

```
https:\\example.com\docs\guide\introduction\
https:\\example.com\docs\guide\getting-started\
https:\\example.com\help\faq\
```

https:\\example.com\docs\guide\introduction\
https:\\example.com\docs\guide\getting-started\
https:\\example.com\help\faq\

### What is the use of this plugin ?

Expand Down Expand Up @@ -135,6 +132,10 @@ Yes, if you want to pull posts from the a folder in a repository then you can sp

## Changelog

### 1.0.1
* Fix: Webhook is changed to `POST` method.
* Fix: Readme formatting.

### 1.0
* First version of the plugin.

Expand Down

0 comments on commit b7c8940

Please sign in to comment.