Sub topic 8
Configuring the template chooser
This chapter assumes you can read YAML, have write access to a repository, and have already created at least one issue template in .github/ISSUE_TEMPLATE/. The template files themselves are covered in earlier chapters. Here you will control what the chooser shows around them.
What the chooser is
When someone clicks New issue, GitHub shows a page listing your issue templates. This page is the template chooser. By default it also offers an Open a blank issue link, which lets people skip every template.
One file controls the rest of the chooser: .github/ISSUE_TEMPLATE/config.yml. The name must be exactly config.yml, and the file must be on the default branch like the templates. It does not define any template. It only changes how the chooser behaves.
The two settings
The file supports two top-level keys.
| Key | Type | Effect |
|---|---|---|
| `blank_issues_enabled` | boolean | When `false`, hides the blank issue link. When omitted, blank issues stay enabled. |
| `contact_links` | list | Adds entries to the chooser that point to URLs outside the issue tracker. |
Each item in contact_links needs three fields:
name: the title of the entry.url: where the entry sends the reader.about: a short description shown under the title.
A working example
This file turns off blank issues and sends usage questions to Discussions:
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/OWNER/REPO/discussions
about: Use Discussions for usage questions instead of opening an issue.Replace OWNER/REPO with your own repository path. Commit the file to the default branch, then open the New issue page. You should see your templates followed by an Ask a question entry. The blank issue link is gone.
You can add several contact links. Common uses are a security reporting page, a support forum, or a documentation site.
blank_issues_enabled: false
contact_links:
- name: Report a security vulnerability
url: https://github.com/OWNER/REPO/security/policy
about: Please do not open a public issue for security problems.
- name: Read the documentation
url: https://example.com/docs
about: Check the guides before asking for help.Why disable blank issues
A blank issue bypasses every required field in your issue forms. If you rely on forms to collect a version number or reproduction steps, the blank issue link undermines that. Setting blank_issues_enabled: false forces people through a template.
Make sure you have a template for every kind of report you want. Otherwise people with a legitimate request have no way to file it. A catch-all template, such as a general feedback form with a single textarea, solves this.
Common mistakes
- Wrong location. The file must sit inside
.github/ISSUE_TEMPLATE/. Aconfig.ymlat the repository root or directly in.github/has no effect on the chooser. - Wrong branch. Changes only appear once they are on the default branch. Testing on a feature branch shows nothing new.
- Missing fields in a contact link. An entry without
name,url, oraboutis invalid. Include all three. - YAML indentation errors. List items under
contact_linksmust be indented consistently. A malformed file can make GitHub ignore your settings, so view the chooser after every change. - Expecting it to change pull requests. The file only configures the issue chooser. Pull request templates have no equivalent.
Check your understanding
Exercise
You add a config.yml with blankissuesenabled: false and a contact link, but the New issue page still shows the blank issue link and no contact link. List two likely causes.
Show answer
First, the file may not be in .github/ISSUE_TEMPLATE/ or may not be named exactly config.yml. Second, the change may not be on the default branch yet, for example if it is still in an open pull request. A YAML syntax or indentation error, or a contact link missing name, url, or about, are also possible.