- Create a new markdown or jupyter notebook file in the
website/contentfolder. - Add the file to the
website/_toc.ymlfile to make it appear in the sidebar. - There might are three places, where you also might want to add a link to the new page:
website/intro.mdfor the main pagewebsite/content/502A/syllabus.md(for 502A)website/content/502B/syllabus.md(for 502B)
To make files accessible everywhere (e.g., when using the notebooks in google colab), we use static files:
- add the image to the
web_static/imagesfolder - Use the following code snippet to display the image. (Replace
/<file-name>with the name of the image file.)
- Add the pdf file to the
_static/pdffolder. - Add the following code snippet to the markdown file where you want to display the pdf file. (Replace
<file-name>with the name of the pdf file.)
<iframe src="https://princetonuniversity.github.io/NEU-PSY-502/_static/pdf/<path-to-file>" width="100%" height="600px"></iframe>The website is automatically built and deployed using GitHub Actions.
The build process is triggered whenever a new commit is pushed to the main branch.
The website is deployed to the gh-pages branch.
To preview the website locally, you can use the following steps:
Change to the website directory:
cd websiteInstall the required packages:
pip install jupyter-book
pip install psyneulinkBuild the website:
jupyter-book build .There now should be a build directory. You can preview the website by looking at the index.html file in the _build/html directory.
If you want to make changes to the website without executing all the notebooks, you can disable this by changing the _config.yml file in the website directory.
Change the following line:
execute:
execute_notebooks: force
to:
execute:
execute_notebooks: off
The notebooks are processed before uploading to the website. For the development of the notebooks, this has one main implications:
There are three "magic" tags that will render differently on the website than in the local jupyter notebook:
- {exercise}
- {hint}
- {solution}
If you add these to the end of the first line of a cell (for example after the title), these will be rendered with special colors and the hints and solutions will be hidden by default.