|
| 1 | +# TinaCMS |
| 2 | +TinaCMS is the content management system that Reactome is using for the majority of its pages and all of its articles. This document will instruct you on how to **add**, **edit** and **customize** TinaCMS pages. |
| 3 | + |
| 4 | +### Important!!! |
| 5 | +Before making any changes make sure your working git branch is up to date with origin/main. To do this run ````git pull```` or ````git fetch````. |
| 6 | + |
| 7 | +## Adding a new page to Reactome from the Browser |
| 8 | +Adding a page to Tina can be done in a few steps |
| 9 | +1. **Choose where you are adding the page** |
| 10 | +Depending on whether you are adding an *about*, *content*, *documentation*, *tools*, *community*, *news*, *FAQ*, or *research spotlight* page will determine how you proceed. |
| 11 | + |
| 12 | +2. **Start your Reactome local dev environment** |
| 13 | +If you followed the ````documentation/local-environment.md```` tutorial run ````npm start```` |
| 14 | +If you followed the ````documentation/local-environment-docker.md```` tutorial run ````docker compose up --build```` |
| 15 | + |
| 16 | +3. **Navigate to /admin** |
| 17 | +4. **Go to the collection you would like to add to** |
| 18 | +Find the "Navigation Menu" button and click on the *collection* you would like to add to. |
| 19 | +5. **Click Add File** |
| 20 | +6. **Edit your page / article** |
| 21 | +Don't forget to set the DatePublished! |
| 22 | + |
| 23 | +7. **Click Save** |
| 24 | +8. **Refresh your local environment** |
| 25 | +Stop it with ````^C```` and run again with the command from *Step 2* |
| 26 | + |
| 27 | +Your Page will now appear in your local environment. To publish it view the *publishing to github* portion of this tutorial. |
| 28 | + |
| 29 | +## Editing a TinaCMS page from the Browser |
| 30 | +To Edit a pre-existing page in your local dev environment follow the following steps. |
| 31 | +1. **Start your Reactome local dev environment** |
| 32 | +If you followed the ````documentation/local-environment.md```` tutorial run ````npm start```` |
| 33 | +If you followed the ````documentation/local-environment-docker.md```` tutorial run ````docker compose up --build```` |
| 34 | +2. **Navigate to /admin** |
| 35 | +3. **Go to the collection you would like to edit from** |
| 36 | +Find the "Navigation Menu" button and click on the *collection* that the article you would like to edit is in. |
| 37 | +4. **Find your chosen article** |
| 38 | +5. **Click on the ... menu and select Edit in Admin** |
| 39 | +6. **Edit your page / article** |
| 40 | +7. **Click Save** |
| 41 | + |
| 42 | +8. **Refresh your local environment** |
| 43 | +Stop it with ````^C```` and run again with the command from *Step 1* |
| 44 | + |
| 45 | +Your edited page will now appear in your local environment. To publish your changes, view the *publishing to github* portion of this tutorial. |
| 46 | + |
| 47 | +## Adding and Editing Pages Through mdx files |
| 48 | +If you would prefer to use your own .md or .mdx file editor or do not wish to use a local dev environment -- you can instead edit the files directly. |
| 49 | + |
| 50 | +All articles and pages are stored in the ````projects/website-angular/content```` directory of this repository. Simply find the collection relevant to your page (i.e ````about/news```` for News articles) and add or edit the relevant files as you see fit. |
| 51 | + |
| 52 | +If you are adding net new files please follow these templates. |
| 53 | +For articles ````about/news````, ````content/reactome-research-spotlight```` or ````documentation/faq````: |
| 54 | +```` |
| 55 | +--- |
| 56 | +title: <Title Here> |
| 57 | +date: <YYYY-MM-DD> |
| 58 | +author: <Author Here> |
| 59 | +tags: |
| 60 | + - tag |
| 61 | +image: /uploads/<upload path here> |
| 62 | +--- |
| 63 | +
|
| 64 | +<Article Body Here> |
| 65 | +```` |
| 66 | +For all other types of pages: |
| 67 | +```` |
| 68 | +--- |
| 69 | +title: <Title Here> |
| 70 | +description: <Description Here> |
| 71 | +category: <about, content, documentation, tools, community, download> |
| 72 | +image: /uploads/<upload path here> |
| 73 | +--- |
| 74 | +
|
| 75 | +<Body Here> |
| 76 | +```` |
| 77 | + |
| 78 | + |
| 79 | +## Publishing to Github |
| 80 | +Once you are happy with your changes its time to publish them to github for review. This will require a github account so make sure you have one [here](https://github.com/login). |
| 81 | +Once you are ready run these commands from your clone of the repository. |
| 82 | +```` |
| 83 | +git status |
| 84 | +git switch -c <Your Article/Branch Name Here> |
| 85 | +git add . |
| 86 | +git commit -m "<Your Commit Message Here>" |
| 87 | +git push -u origin <Your Article/Branch Name Here> |
| 88 | +```` |
| 89 | +Your branch is now available on the remote repository where you can make a pull request and have your article reviewed. Once everything has been approved the pull request (PR) can be merged into the working branch from which it can be put into the next release. |
| 90 | + |
| 91 | +If you are uncomfortable with command line there are convenient tools like the [VScode extension](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions) or [Github Desktop](https://www.gitkraken.com/download?_gl=1*u0whzn*_up*MQ..*_gs*MQ..&gclid=CjwKCAjwhLPOBhBiEiwA8_wJHPBQZEe_3tLOunlEc4lXI8wM8Wxgpov5AYK6cOdTyhM8m1IfV02dCRoCaXgQAvD_BwE) that can make things easier. |
| 92 | + |
| 93 | +## Other Notes on TinaCMS |
| 94 | +- If you ever have to edit the collections or general setup of TinaCMS that can be done in ````projects/website-angular/tina/config.ts```` |
| 95 | +- If you need to make a home / landing page for a collection (i.e *about/*, *content/*) just name the file ````index.mdx```` and place it in the correct folder |
| 96 | +- Additional Information about TinaCMS can be found [here](https://tina.io/) |
0 commit comments