Developing a GROWI Plug-in (Template Edition)
Tags: opensource, growi, markdown
Published: 2024-07-08 04:07:38

---
title: Developing a GROWI Plug-in (Template Edition)
published: true
description: 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.
tags: 
  - OSS
  - GROWI
  - Markdown
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-06-21 05:04 +0000
---

[GROWI](https://growi.org/ja/), 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](https://docs.growi.org/ja/guide/features/template.html#%E9%9A%8E%E5%B1%A4%E3%81%AB%E5 %AF%BE%E3%81%97%E3%81%A6%E3%83%86%E3%83%B3%E3%83%95%E3%82%9A%E3%83%AC%E3%83%BC%E3%83%88%E3%82%92%E9%81%A9%E7%94%A8%E3%81%99%E3%82 8B%E6%96%B9%E6%B3%95) 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](https://github.com/goofmint/growi-plugin-templates-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
```

## 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.

```js
{
  "name": "growi-plugin-templates-for-template", // fix here
  "version": "1.0.0",.
  "description": "GROWI template plugin for template", // modify here
  // omitted
}
```

## 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`.

```javascript
{
  // omit
  "growiPlugin": {
    "schemaVersion": "4",.
    "types": [
      "template".
    ],.
    "locales": [
      "en_US", "ja_JP" // add here
    ]
  }
}
```

## Fix the metafile

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

```js
{
  "title": "Example title" // Fix here.
}
```

## Modify template

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

```markdown
## Example template

Describe the contents of a great template here!
```

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](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/197026/e1b4e220-575a-b179-2c70-d4382dd9db48.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](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/197026/6920dc59-9be0-15dc-1f3f-0061b67293a4.png)


### Use

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

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/197026/0742b182-5bc2-416f-59fb-4e665419f82c.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](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/197026/b3066af0-1646-bce9-c101-ffaffea71a35.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](https://growi.org/ja/)