DEV Community

Atsushi
Atsushi

Posted on • Updated on

Developing a GROWI Plug-in (Template Edition)

GROWI, an open source in-house wiki, has a plug-in feature. It can be used to display your own data or to customize the display.

In this article, I will explain the procedure for developing a GROWI plug-in. This is as much as we know, as we have not yet grasped the whole process, but please use it as a reference during development.

Types of plug-ins

There are three types of GROWI plug-ins

  • script
  • theme
  • template

This time, we will focus on script (template).

Notes

In GROWI, you can use page template function is also available. The templates discussed in this article will be usable templates that can be created on any page and plugins that can be published and shared online.

Templates

We have created a template that can be used to create plug-ins. This is the basis for the explanation.

goofmint/growi-plugin-script-template

Plugin configuration

No coding knowledge is required for the template plugin. You can edit it under the dist folder. The structure is as follows.

% tree .
.
.└── example
    ├── en_US
    │ ├── meta.json
    meta.json │ └── template.md
    └── en_US │ └── meta.json │ └── template.md
        └─ meta.json
        template.md

3 directories, 4 files
Enter fullscreen mode Exit fullscreen mode

Create a new template.

Copy or rename the example folder. You can name it anything you like, but make sure it is easy to understand for later maintenance. You can create multiple templates.

Rename the package

The package name is defined in package.json. Change it first.

{
  "name": "growi-plugin-templates-for-template", // fix here
  "version": "1.0.0",.
  "description": "GROWI template plugin for template", // modify here
  // omitted
}
Enter fullscreen mode Exit fullscreen mode

Fix per locale

GROWI supports Japanese and English by default. There are en_US and ja_JP folders for each locale. To add other languages, modify package.json. Currently, GROWI also supports zh_CN and fr_FR.

{
  // omit
  "growiPlugin": {
    "schemaVersion": "4",.
    "types": [
      "template".
    ],.
    "locales": [
      "en_US", "ja_JP" // add here
    ]
  }
}
Enter fullscreen mode Exit fullscreen mode

Fix the metafile

In the metafile meta.json, set the name of the template listing.

{
  "title": "Example title" // Fix here.
}
Enter fullscreen mode Exit fullscreen mode

Modify template

The content of the template is template.md. Feel free to edit the content.

## Example template

Describe the contents of a great template here!
Enter fullscreen mode Exit fullscreen mode

You are now free to create your own template.

Create template content

Creating a template is actually easier to write on GROWI. Make sure the resulting content is OK and copy it into template.md.

image.png

Using the template

Here are the steps to use the template you have created.

Notes

The template must be published as a Git repository.

Installation

Please enter the URL of the Git repository.

image.png

Use

To use, go to the Edit Page screen and click the file icon at the bottom.

image.png

A list of templates will be displayed, from which you can select the template you wish to use. You can also specify the locale.

image.png

Summary

By using template plug-ins, you can quickly create pages with a common structure. Also, by using a comprehensive page template, you can avoid omissions and omissions of description and consideration.

Please make use of templates.

GROWI, an OSS development wiki tool | comfortable information sharing for all

Top comments (0)