Skip to content

How to Edit Rules

Daniel Mackay [SSW] edited this page Oct 28, 2022 · 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 (ideally in Markdown, rather than rich text, as this minimises unwanted artifacts from the CMS). 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. Tip: If you have substantially improved a rule, feel free to add yourself to the acknowledgements section.

  2. 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, setting the status to 'In review' submits your changes for approval before they are added to SSW Rules.

Note: If you don't want to publish just yet, your changes will be waiting for you as a draft. Simply open the editor again when you're ready to continue editing.

Figure: Set the status to 'In review'

  1. Check the status of your changes in the Workflow tab of Netlify CMS. You can see all changes that are drafted and in review.

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

Video: How to rename a rule

Video: How to rename an SSW Rule?

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

  1. Change the title: field in the frontmatter
  2. Change the uri: field in the frontmatter
  3. Add the old URI to the redirects list in the rule
  4. Rename the rule's folder to be the same as the new URI
  5. 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
---

How to Rename a Folder in GitHub

  1. Open the rule in GitHub
  2. Click the 'Edit' button

Edit button in GitHub Figure: Open the Editor in GitHub

  1. Click the file name at the top of the editor
  2. Move the cursor to the start of this field

File name editor Figure: Place your cursor in the file editor

  1. Press 'backspace' on your keyboard to open the editor field for the folder name
  2. Change the folder name

Folder name editor Figure: Pressing 'backspace' will move the editor field to the folder

  1. Press '/' on your keyboard to navigate back to the file name
  2. Ensure the file name is the same as before (usually 'rule.md'

Changed folder name Figure: Press '/' and make sure the file name is correct

  1. Save your changes at the bottom of the page as you would with any other change

How to find and update rules' categories

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 like this 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