Skip to content

How to Edit Rules

Taine Riley edited this page Jul 28, 2021 · 40 revisions

Editing on GitHub is sooo much better than sending an email in the format of change x to y. It's fast, allows us to look at previous changes and gives you credits on your GitHub stats!

Better again is using the newly added Netlify CMS interface to edit rules without the hassle of worrying about branches, forks and pull requests. All of this is done automatically behind the scenes, and you still get all the benefits to your stats!

Figure: Some good GitHub stats 😄

How to Edit Rules: Using Netlify CMS

Using the Netlify CMS interface to edit rules is easy! Simply follow these steps:

  1. Navigate to the rule you want to edit on SSW Rules.
  2. Click the pencil icon to open the Netlify CMS editor.

Figure: Click to edit

  1. Use the editor in the left column to edit the details of the rule. You can preview your changes in the right column as you make them.

Note: The actual content of the rule is in the Body field.

Figure: Netlify CMS interface for a rule

  1. Click 'Save' to save your changes to the rule as a draft.

Note: To delete these changes use the 'Delete unpublished changes' button next to 'Save'.

Figure: Changes saved as a draft.

  1. When you are ready to publish your changes, set the status to 'In review'. This submits your changes to be added to SSW Rules.

Figure: Netlify CMS interface for a rule

  1. Check the status of your changes in the Workflow tab of Netlify CMS.

Figure: See all your edited rules

How to Edit Rules: Using Forks

We use forks to edit rules because they don't require write permissions to the SSW.Rules.Content repository, which many people don't have!

To get started, do you have a fork of the SSW.Rules.Content repository? If not, follow the steps in this wiki page: Creating your Fork (One time setup)

Now you have your forked repository, follow these steps:

  1. Go to your forked repository: {User}/SSW.Rules.Content.
  2. Navigate to a file you want to change. You can use the Go to file button to search for a rule.

Note: Alternatively, use the 'Edit in GitHub' button on a rule or category in the SSW Rules website to open it in GitHub.

Figure: Search for your file by clicking Go to file

  1. Click on the pencil button to edit the file.

Figure: Click edit a rule

  1. Once you are happy with your changes, scroll to the bottom of the page to the commit box. Add a useful commit message and description, and make sure you are committing directly to the main branch of your forked repository.

Figure: Commit your changes

  1. Merge your changes, by following Merging Your Fork

Updating your Fork

If you haven't touched your Fork in a while, it might be quite far behind the SSW.Rules.Content repository. You can tell if it is behind by looking at the message on your fork, as shown below. Follow the steps here to update your fork: Updating your fork

Figure: Message indicating out of date fork.

Renaming Rules

When you change a rule's URI, there are 4 important steps:

  1. Change the uri: field in the frontmatter
  2. Add the old URI to the redirects list in the rule
  3. Rename the rule's folder to be the same as the new URI
  4. Find the URI in the rule's category and update it.

For example, this rule was changed from

Path: rules/accommodation---do-you-know-the-best-online-accommodation-websites/rule.md

---
type: rule
archivedreason: 
title: Accommodation - Do you know the best online accommodation websites?
guid: 8d59feea-03b4-4cfc-b26e-77b2655293d9
uri: accommodation---do-you-know-the-best-online-accommodation-websites
created: 2015-04-28T05:06:33.0000000Z
authors: []
related: []
redirects: []
---

To:

Path: rules/do-you-know-the-best-accommodation-websites/rule.md

---
type: rule
archivedreason: 
title: Accommodation - Do you know the best online accommodation websites?
guid: 8d59feea-03b4-4cfc-b26e-77b2655293d9
uri: do-you-know-the-best-accommodation-websites
created: 2015-04-28T05:06:33.0000000Z
authors: []
related: []
redirects: 
 - accommodation---do-you-know-the-best-online-accommodation-websites
---

To find all the categories that this rule is in, follow these steps

  1. Navigate to the rule on ssw.com.au/rules

  2. Click on the category in the breadcrumb

  3. In the category, click the edit button in the top right. You will be navigated to the category file in GitHub

  4. Open the same file in your fork of the repository

  5. Click the edit pencil

  6. Find the old URI in the index and change it to the new one

  7. If there is more than one category in the breadcrumb in step 2, repeat steps 2 - 6 for each category.

Using Markdown

All rules are written in Markdown, and so you're going to need to know it if you want to edit one! If you want to brush up on your skills, see Using Markdown.

Figure: A rule using markdown

Next Step

See How to Create Rules

Clone this wiki locally