Building: Writing responses

GitHub Learning Lab's mascot A course on GitHub Learning Lab can guide you through this step.

Responses are stored in the responses/ folder within the course repository. Each response should be a Markdown file. The name doesn't matter, but you can use some naming conventions to help, such as numbering your responses (1-welcome.md), or prefixing the filename with e if the response is for helping learners navigate from errors (e-you-didnt-comment.md).

For more detail into response best practices, see the appendix.

Variables

Throughout the course, you can make use of template variables to create a more personalized experience for your users. Here are all of the available template variables that you can use in your responses:

Property Description
course.title The title of the course.
course.slug The slug of the course. If the course is titled "My Course", the slug will be "my-course."
user.login The username of the user taking the course.
preferences[preference_name] Get the value of a preference choice made by the user. This will look like preferences.name_of_preference.
owner The owner of the repository that the user is taking the course in. This is usually the user, but for private courses it will be the login of an organization.
repo The name of the repository that the user is taking the course in. This is particularly useful for private courses, as repo names are namespaced for the user.
repoUrl The URL for the user's repository.
GHE_HOST Domain hostname (and optional port) if Learning Lab is running on GitHub Enterprise Server. Otherwise undefined.

Usage examples

@{{ user.login }} refers to a user by their handle. This can create a more personal and engaging experience for your users.

An example of the learner's view and the source:

Learner view Source in Markdown
image image

It's also possible to create your own variables, see Passing data into responses.