Renaming a collection

A common request is to rename one of the collections, for example rename “Services” to “Courses”.

Guide

1. Rename the collection settings

Edit the collection settings in the _config.yml. Update the collection name and defaults.

# _config.yml
---

....

collections:
  services: # change to courses
    output: true
    permalink: /:collection/:path/

....

defaults:
  - scope:
      path: ''
      type: services # change to courses
    values:
      layout: service # change to course

....

2. Rename the folders

Rename the collection folder collections/_services to collections/_courses

Update the services page pages/services.md frontmatter.

# pages/services.md
---
layout: list
collection: 'services' # change to courses
title: Services # change to Courses
description: 'We deliver a complete range of digital services.'
permalink: '/services/' # change to /courses/
header_transparent: false

hero:
  enabled: false
  heading: "Services" # change to Courses

....

Rename the file to pages/services.md to pages/courses.md

3. Update the layout

Update _layouts/service.html to _layouts/course.html

4. Update the homepage section

Edit pages/home.md and update the services featured block to courses.

# pages/home.md
---
---
services: # change to courses
  enabled: true
  heading: 'Our Services'
  sub_heading: ''
  limit: 3
  sort: 'weight'
  view_more_button_enabled: true
  view_more_button_text: 'View All Services'
  view_more_button_link: '/services' # change to /courses
  hide_thumbnail: false
  hide_icon: false
  hide_description: false
---

Edit _layouts/home.html and update the include that renders the services to render the courses.

Replace all page.services with page.courses

<!-- _layouts/home.html -->

{% if page.courses.enabled %}
  <div class="strip strip-base">
    <div class="container">
      {% include components/grid.html 
        collection="courses"
        heading=page.courses.heading
        sub_heading=page.courses.sub_heading
        limit=page.courses.limit
        sort=page.courses.sort
        view_more_button_enabled=page.courses.view_more_button_enabled
        view_more_button_text=page.courses.view_more_button_text
        view_more_button_link=page.courses.view_more_button_link
        hide_thumbnail=page.courses.hide_thumbnail
        hide_icon=page.courses.hide_icon
        hide_description=page.courses.hide_description
      %}
    </div>
  </div>
{% endif %}

5. Cleanup

You will need to go through all the new course files and markdown files and update the titles etc to refer to courses instead of services.