Making a change

A guide to making changes and committing them to your code repository.

All changes you make to your website code will follow the same process:

  1. Make and test your change locally (this guide)

  2. Push your change and submit for review (the contributing guide)

  3. Publishing your changes (the publishing guide)

Requirements

In order to make a a change and publish it, you'll need the following:

Where is...

All requests to a site using the BaseCMS Website Framework first start at the projects index.js file. By convention, this should be listed in your package.json under the main key. Starting with this file, you can trace every request through your website and make changes where necessary.

The index file will use the startServer utility from the @parameter1/base-cms-marko-web package. This utility accepts many arguments, each of which can be overwritten to customize the behavior of your site.

Creating a branch

A typical best practice for working with Git is to never make changes to the master branch. Depending on how your repository is set up, you may not even have permission to modify the master branch! All modifications and features should be done on a new branch, which can then be used for a Pull Request in the contributing guide.

To create a branch, click on "Current Branch" and select "New Branch". You can also use the Git CLI to create a new branch:

git checkout -b <my-branch-name>

Changing a navigation item

From the index file, you'll note that the siteConfig argument is passed through. This file (config/site.js) contains an include for a navigation.js file, with entries for primary, secondary, tertiary, footer, and menu items. Let's add a new primary navigation item and save the file:

When the navigation.js file was changed, the website framework will automatically rebuild the Marko templates and refresh the page in your browser:

If your page didn't reload automatically, or the file change was not detected, you may need to restart Docker and/or your machine. You can also try stopping and starting the website service again.

Saving your changes

Now that our change works as expected, we need to commit our modifications and push them to our repository. To do that, switch back to GitHub Desktop, and your local modifications should be displayed.

Enter a message describing your changes in the commit message field, and then click on commit.

You can also use the git status, git diff, git add, and git commit commands to see changes, stage, and commit them.

Once your change(s) have been committed, you'll want to make sure your branch is published (with the Publish Branch button), or pushed (if already published).

You can use the git push command to push these changes to your fork:

git push origin my-branch-name

Next, you'll want to get your changes approved for deployment, which we'll cover in the next guide.

Last updated