mywebsite (https://timothytrippel.com)
A simple Python-generated static website tailored for Ph.D. students and/or academics with active research projects and/or publication lists. See link above for the deployed final product.
This repository contains a static site generator written in Python (based on the popular makesite.py project), and all the layout/content files for my personal website (above). Feel free to test it out and modify it to fit your needs.
Below I describe the directory structure of this project.
It is IMPORTANT this directory structure is maintained for all content,
layouts, and style/script files or the makesite.py
script will not process
them correctly.
The content/
directory contains five separate sub-directories: one to hold the
content that is displayed on each page of the (generated) website (i.e.,
index.html, experience.html, publications.html, and research.html), and
one that stores content shared across pages (e.g., lists of links to media
related to different projects I've worked on).
There are a few things to note about content files and how they are organized:
-
Markdown and HTML are currently the only supported content file formats.
-
Content files that are nested within sub-directories of the page-specific content directories (e.g.,
experience/past_jobs/*
) are interpreted as listable content by themakesite.py
script. For example, each content file inexperience/past_jobs/
will fill a matching list item layout template defined inlayout/list_items/
(i.e.,layout/list_items/past_jobs.html
). Then, all processed list items will be combined into a single list element to fill a matching tag in the final layout, i.e., the {{ past_jobs }} tag inlayout/pages/experience.html
. -
Content files that are placed directly under the corresponding page-specific content directories are NOT listable, and will fill a matching tag directly in the corresponding page layout in
layout/pages/
. For example, thecontent/index/bio.md
content file will fill the {{ bio }} tag inlayout/pages/index.html
. One exception to this rule is the the content files incontent/publications/*
which are listable, since they are told to be listable in themakesite.py:320
script.
The layout/
directory contains three separate sub-directories that contain
HTML layouts of the various site pages and page elements.
-
layout/base/
: contains two base layouts that define the navigation bar (nav.html
) and general structure of each website page (page.html
). The navigation layout gets injected into the page layout, and the page layout gets injected with different page-specific layouts to form the final website pages. -
layout/list_items/
: contains several list item layouts for various list (<ul></ul>) elements embedded in each page. These layouts get injected with content that is nested within sub-directories of the page-specific content directories (Section I.A.2). -
layout/pages/
: contains a layout for each page in the final website. These layouts get injected with content from the page-specific content directories (Section I.A).
The static/
directory contains static styling, scripts, images, documents
(e.g., my CV), and publication manuscripts/slides.
The third_party
directory contains third party styling and scripts used to
construct this website. All third party files are accompanied with license
headers that dictate their terms of use.
Follow these steps to generate and serve the website locally (at localhost:8000):
- fork this repository
cd mywebsite
- create a Python
virtualenv
for this project - install all Python dependencies in the
virtualenv
withpip install -r requirements.txt
make test
I use [Prettier] as a code formatter for all things web-related
(HTML/Markdown/CSS/JavaScript). It keeps things tidy and is easy to install with
the Node Package Manager (npm
) that can be installed
here. Once npm
is installed, and you fork
this repository, you can install prettier simply (since the JSON files
describing package dependencies are included in the repository) with:
npm install
To modify this site to suit your needs:
- Fork this repository.
- See below for example modifications.
- Open the
params.hjson
file. - Edit contents with your information.
- Copy an example content file in
publications/
. - Edit the date in the name of the file (this is used to order them by date).
- Edit the contents of the file.
- If you have links to other content related to this publication, e.g. videos,
slides, etc., add a content file with only these links in
content/shared/
directory (see existing examples), so these links can be used on other pages too.
Follow steps 1-3 in above (Adding a Publication), but see example content in
content/index/news/
.
Follow steps 1-3 in above (Adding a Publication), but see example content in
content/experience/past_jobs/
.
- Read Section I.A (above) thoroughly.
- Create a new HTML page layout file in
layout/pages/
. - Add any page styling to
static/css/default.css
. - Add any scripting to
static/css/custom.js
. - Create a matching content directory in
content/<name of page>/
. - Fill content directory created above with content files that match tags in the page layout.
- Read Section I.A (above) thoroughly.
- Create a new list item layout file in
layout/list_items/
that has a tag for where the list will be injected. - Add any list styling to
static/css/default.css
. - Add any scripting to
static/css/custom.js
. - Create a matching listable content directory in
content/<name of page>/<item list tag>/
. It is important this directory name matches the tag in the page layout where the list will be injected. - Fill content directory created above with content files that will fill list items.
I use AWS Amplify for hosting and continious deployment of my site. It costs only $1.50/mo (at the time of writing), and is both simple and reliable. Configuring the deployment is so easy, I messed up the configuration during my first two attempts because I thought it required more button clicking than necessary.
To avoid my mistakes, and deploy this site to AWS Amplify:
- Make an AWS account.
- Log in to the AWS console.
- Register a domain for your site. I use AWS Route 53 (search for it in the console).
- Search for AWS Amplify in the console.
- Click "New app"->"Host web app"
- Select GitHub as location of source code.
- Authorize AWS to access your GitHub repositories.
- Select your GitHub that contains your app, and click "Next"
- Upload the build configuration (
amplify.yml
) contained in this repository. - Wait for it to provision resources and build the site.
- Verify the site looks like it did when you tested it locally.
- Click "Connect a Domain" and follow the instructions.
Now, anytime you push a commit to your fork of this GitHub repository, AWS Amplify will pull down the changes and automatically deploy them to your site!