Skip to content

Add support for templates in wikis

Himanshu Kapoor requested to merge himkp-poc-wiki-templates into master

What does this MR do and why?

Add support for templates in wikis

  1. Templates are wiki pages too, but in UI we call them "templates" instead of "pages".
  2. Templates are stored in /wiki/templates/ directory.
  3. To access all templates or to create a new template or edit an existing template, click the new "Templates" link in the sidebar.
  4. You can do all actions that were previously possible on wiki pages on templates as well. This includes template version history, author details and diff comparison with previous version.
  5. We support templates in all formats: Markdown, RDoc, AsciiDoc and Org.
  6. Attachments are disabled for templates.
  7. This feature works in both project and group wikis. Group wikis are EE only.
  8. You can create/edit templates in both plain and rich text editors.
  9. Template dropdown filters templates by the format type you choose. Eg. Markdown templates can only be applied on Markdown pages.

Out of scope of this MR:

  1. Inheriting templates: A project should be able to inherit and use templates from its own wiki and also any parent group wikis.
  2. File attachments in templates: If you upload a file/image in a template, and then later use that template, the file/image will be broken, so I disabled this feature. To support it properly, we need to map paths of the file/image to the path of the current wiki page.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

wiki templates demo.m4v

How to set up and validate locally

  1. In the wiki sidebar (right), click the new "Templates" link
  2. Click "+ New Template"
  3. Fill in the details and save.
  4. Go back to wiki home page.
  5. Create a new page by clicking "New Page".
  6. In the template dropdown above content, select the template you just created.
  7. Template should apply to the wiki page.

Related issues/epics

Edited by Himanshu Kapoor

Merge request reports