This repository contains the development and distribution code for the Global Brain Consortium website.
This section will detail how to add content to the website. For more detailed information, please read the Content Management section of this README.
The quickest way to add content is to be added as a contributor to the repo. You can email derek.lo@mcin.ca to request this.
The next step is to clone or fork the repository so that you can make changes locally. To do this, please read the documentation on cloning or forking.
If you would like to preview your changes locally, please follow these steps on "running locally".
After cloning or forking the repository, go to your local drive and change the directory to the repository. Follow these steps to add a News or Event item:
- From the root directory, go to the
src/resources
folder - Duplicate an existing
.njk
file and rename it using the following naming convention:(yyyy)(mm)(dd)-name.njk
- Place an image for the item in the following folder:
src/assets/images/content/news
- Edit the content of the new
.njk
by changing the following fields:- title:
'item title'
- date:
yyyy-mm-dd
- type:
resource
orexternal
oryoutube
orpdf
orregister
- see type explanation for more details
- image:
"/assets/images/content/news/(filename)"
- resource_link:
"(link to the resource. this is optional)"
- excerpt:
A brief description of the item in plain text with no special characters like colons or asteriks
- title:
- Save your file
- Create a pull request to
main
branch
You can see an example of how the cards look by going to the News & Events page.
Similar to above, adding a card for the Newsletters requires a few different steps:
- Duplicate an existing
.njk
file in the 'resources' folder. - Change the name of the
.njk
file using the following naming convention:(yyyy)(mm)(dd)-name.njk
- Put the PDF in the folder
"src/assets/images/content/newsletters/"
- Edit the content of the
.njk
file as above with the following differences:- type:
resource
- resource_link:
"/assets/images/content/newsletters/(filename).pdf"
- type:
- Save your file
- Create a pull request to
main
branch
The network page contains all the members of the Global Brain Consortium. To add a member, please follow these steps:
- Place an image of the member in the following folder:
src/assets/images/people
. The aspect ratio of the image should be square - From the root directory, go to the
src/raw-data
folder - Open
people.tsv
with your favorite editor (.tsv stands for Tab-Separated Values) - In the field labelled
slug
type in the value(first name)-(last name)
- In the field labelled
name
type in the member's name - In the field labelled
image
type in the url as follows/assets/images/people/(filename)
- In the field labelled
affiliation
type in the member's affiliation, preferably a short version - In the field labelled
steeringGroupMember
type inFALSE
unless the member is part of the Steering Committee, in which case enterTRUE
- In the field labelled
expertiseTags
copy the fields from another entry and paste it here. The tag filter is not currently active on this page. - In the field labelled
website
enter the url for the member's website (optional) - Save the
people.tsv
file - Create a pull request to
main
branch
Most maintenance of this site will involve adding small pieces of content with standard format (such as new resource listings or new network members). This is achieved using a standard process of making commits to the remote git repository. If you are not familiar with git and GitHub, this introduction may be useful.
If there is only one developer maintaining the site at any given time, adding small amounts of new content to the site typically consists of three steps: adding the content to your local copy of the site (see "Running Locally" below); committing the changes locally to the main
branch; and pushing those changes to the remote repository.
If multiple developers are simultaneously adding content, or if substantial amounts of new content or changes to the site structure are required, any changes should be committed to a local development branch separate from main
. A pull request should then be opened and reviewed by site developers before these changes are merged into the main
branch.
Data for a new member can be added to the network section of the website by editing the src/raw_data/people.tsv
file. This file is a standard tab-separated value file which can be opened and edited in any spreadsheet software. To add a new person to the file:
- Always start by ensuring that you have the most recent version of the website code by running
git pull
. This will overwrite any changes to local files, so make sure you run this command before adding any new content (and don't run it again until you have committed any changes!) - Open the file in your preferred spreadsheet software
- Insert the data for the new person on a new row under each corresponding header, and save the file.
- If you need to add several new people, their data can be added on new rows all at once. No need to complete all of these steps per individual. The expertiseTags field must have data even though they are hidden on the website. It is recommended to copy/paste an entry from an existing person.
- Test that the site builds correctly in your local environment (see "Running Locally")
- This will automatically generate and overwrite
src/_data/people.json
, which will show up as a change in your local git repository.
- This will automatically generate and overwrite
- Check that the newly added person is visible on the network page of the locally-running site.
- If the person has been added successfully, commit your changes to the
people.tsv
andpeople.json
files to your local master branch. - Push your local main branch to the remote.
These instructions assume a single developer is maintaining the site. If multiple developers are maintaining the site, use the pull
request process outlined previously.
Data for a new partner can be added by editing the src/raw_data/partners.tsv
file. See "Adding new people" above.
News & Events are links to information distributed by the collaboration. These are stored as .njk
files in the src/resources/
directory. To add a new resource, copy one of the existing files and give it a new name appropriate for the resource content being added. You can then open the file to change its content, committing the changes as described above:
A short title for the resource, which will be displayed on the resources page.
A date for the resource (e.g. publication date) in yyyy-mm-dd
format
There are four types of posts:
- resource | Use this type to indicate a link that goes to another page or content that is located on this website. The label is
Read More
- external | Use this type to indicate a link that goes to an external web address. The label is
Go To Link
- youtube | Use this type to indicate a link goes to youtube. The label is
View on YouTube
- pdf | Use this type to indicate a link opens a pdf in the browser. The label is
Open PDF
- register | Use this type to indicate a link that goes to a registration site. The label is
Register to Attend
An optional filepath pointing to an image file to be displayed with the resource. This can be replaced with "" (empty opening and closing quotes) if no image is needed. Otherwise it should be a filepath starting with /assets/images/content/(folder name)
. Ensure that you copy the image into this directory so that it will be added to the website.
An optional URL enclosed in quotation marks, linking to the resource at another location on the web.
e.g.:
resource_link:"https://osf.io/6khrv/"
A short description of the resource which will be displayed as text on the resources page. This must be written on a single line.
A list of expertise tags that members can choose from is stored in src/_data/expertiseTags.json
. They are stored in the "tags" property as string entries in a list. To add a new expertise tag, just add a new string to the list. As mentioned above, this feature is not currently in use. Please just copy the expertise from a previous entry.
In the current version of the website, most other content is hard-coded into the HTML or .njk
template files. You can edit this content by editing these files in the src
directory. Note that all content in the dist
directory is automatically generated and changes will be overwritten when the site is built.
To run a local version of the website for development purposes:
- Install the prerequisite dependencies:
- Clone this repository to your local computer
- In a terminal,
cd
into the root directory of the cloned repo - Run
npm install
to install the dependencies required to build the website - Run
npm start
to serve the website locally (by default, it will be served on localhost:8080)
The public version of the website will be built and deployed automatically when a commit is made to the main
branch of this repository. To run the build script locally, follow the instructions in "Running Locally", replacing the final step with the command npm build
.