The MARS website is built using Docusaurus 2, a modern static website generator. The website contains information about the MARS Group (team page, blog posts, etc.) and the MARS Framework (API documentation and developer documentation).
To set up a local development environment for editing the website, follow these steps:
- In a terminal, navigate to the root directory and run
yarn
to install dependencies. - Run
yarn start
. This command starts a local development server and opens up a browser window. Per default, the server can be reached atlocalhost:3000
.
Webpage content is written in Markdown files and can be edited as such. Depending on your editing needs, work in the following directories:
blog/
: blog postsdocs/
: MARS framework API and developer documentationsrc/pages/
: individual pages such as Imprint, Team, etc.
Most changes are reflected live without having to restart the server.
To create a new blog post, follow these steps:
- In the directory
blog/
, create a new directory (e.g., by duplicating one of the existing directories). - Rename the new directory
Note If the development server crashes after changing the folder structure, see the corresponding entry in the Troubleshooting section for a possible solution.
- In the directory, add content for the blog post in
index.md
Note To add a new author, add a new entry to
blog/authors.yml
.
To creat a new page, follow these steps:
- In the directory
src/pages/
, create a new Markdown (MD) file. - In the new MD file, write the contents that should be displayed on the page. This can include MD source text, HTML source code, and React components. For more details, see the Docusaurus documentation on MD features.
- In the JavaScript (JS) file
docusaurus.config.js
, create a homepage link to the new page via one of the following ways:- To add the link to the top navigation bar, add a new entry to
themeConfig.navbar.items
. For example, the entry{to: '/md-file-name', label: 'MyLinkLabel', position: 'left'},
would create a link in the navigation bar with the labelMyLinkLabel
that links to a page displaying the contents of the filesrc/pages/md-file-name.md
. - To add the link to the footer, add a new entry to the desired section of
themeConfig.footer.links
. Currently, the footer sectionsMARS Framework
,Community
, andMore
are defined. For example, the entry{label: 'Google', href: 'https://www.google.com/'}
in the sectionCommunity
would create a link in theCommunity
section of the footer with the labelGoogle
to the Google search engine homepage.
- To add the link to the top navigation bar, add a new entry to
Note The order of the entries corresponds to the order in which the links are displayed on the page.
To add a new thesis entry on the Theses page, follow these steps:
- Add a PDF version of the thesis to the directory
static/img/student-work/theses/
. - In
src/pages/theses.md
, add a newStudentWork
React component under the applicable header. See the HTML comment insrc/pages/theses.md
for a description of the required parameters. - Save the page to prompt a reload of the server, and check in your browser if the entry is set as desired.
To add a new poster entry on the Posters page, follow these steps:
- Add a PDF version and a PNG version of the poster to the directory
static/img/student-work/posters/
. - In
src/pages/posters.md
, add a newStudentWork
React component under the applicable year header. See the HTML comment insrc/pages/posters.md
for a description of the required parameters. - Save the page to prompt a reload of the server, and check in your browser if the entry is set as desired.
You can write LaTeX code inside the Markdown files. For inline LaTeX, use $ … $
. To create blocks, use the following:
$$
…
$$
You can create dynamic charts with Mermaid.
Create a Markdown code block and set the "language" to mermaid
by writing it after the three opening backticks.
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
yarn build
This command generates static content into the build
directory and can be served using any static contents hosting service.
Using SSH:
USE_SSH=true yarn deploy
Not using SSH:
GIT_USER=<Your GitHub username> yarn deploy
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the gh-pages
branch.
This section covers solutions to common issues that might occur while working with Docusaurus.
When adding new directories or renaming existing directories, the automatic reload might fail and, as a result, the development server might crash. In this case, restarting the development server usually fixes the issue.
- In the terminal window that runs the development server process, enter Ctrl+C to stop the process.
- Reenter
yarn start
to restart a fresh instance of the development server.