/reconhub.github.io

Official website for RECON - The R Epidemics CONsortium

Primary LanguageHTMLMIT LicenseMIT

RECON logo

Welcome to the development page of the R Epidemics Consortium (RECON) website

For the website itself, go to: http://www.repidemicsconsortium.org

Please address requests via email to Thibaut Jombart (thibautjombart@gmail.com).

Instructions for editing the website

Editing the existing pages

When the site launched, it contained the following pages, which can all be edited for content or deleted: index.md (the landing page), people.md, projects.md, resources.md, contact.md.

Editing the navigation menus and the footer section

The links in the menu and in the footer are all configured in the main configuration file, _config.yml. Specifically, the parameter navbar-links inside the file is used to define the top navigation menu, and the author parameter just below it is used to define the information that should be shown in the footer.

How to edit the style of the website

The general layout of the pages can't be changed easily. But things like colour, spacing, fonts, and any other CSS style can easily be changed by adding CSS rules to the recon.css file. For example, you can change the size of the text, or the background colour of the navigation bar, or the colour of the text in the footer.

Note that the template was designed in a way such that it changes drastically when you view it on a big screen (laptop) vs a small screen (phone)

How to add new pages

To add a new page at the URL http://reconhub.github.io/example:

  • Add a file named example.md to the root directory of this repo

  • The file must begin with two lines of three dashes (aka YAML front matter) in order for this new page to use the template. In other words, each file must begin with the following two lines

    ---
    ---
    
  • You can write either in markdown or in pure HTML

  • If you want to add images, I suggest you place all the images inside the img folder and refer to images from there.

  • In between the YAML front matter (between the two lines of dashes), you can specify a few parameters:

    • title: Gives a nice big title to the page
    • subtitle: A subtitle to the page
    • bigimg: The path to an image that will be used as a big wide "header image". This path has to point to a local file in this repository, it cannot point to an image on the web
    • You can see the projects page to see an example of using the title and bigimg parameters
  • If you want to include a list of items on the page, where each item has an image, a short description, and some links, you need to define the items of the list in the YAML front matter and then include {% include list-circles.html items=page.mylist %} in the page wherever you want to show the list. Any images will automatically be cropped to be circular, and there wil be a maximum of 4 items per row. See the people page for an example of how to include a nice list.

How to add new blog posts (aka news)

The pages described above should be added in the root directory. But any page you create inside the _posts folder will be treated as a blog post. The nice thing about blog post-type pages is that they will automatically be shown chronologically at https://reconhub.github.io/blog/, with all the pagination to previous/next posts taken care of.

Posts are created in exactly the same way as regular pages: you still need to make them .md file, they have to have YAML front matter, they can support the title/subtitle/bigimg parameters, you can add lists into them, etc. The only difference is that the name of the file must begin with the date of the post. For example, 2016-08-20-some-news.md. It's vital that the name of each post contain the date in such a format, followed by whatever name you want, followed by .md.

How to enable comments

If you want to add Disqus comments to different pages, you need to sign up to Disqus and add your Disqus shortname to the disqus parameter in the _config.yml file. By default, all blog posts will have disqus comments at the bottom of the page. You can add disqus to any other page by adding comments: true to the YAML of any page.

Updating the members page

The members page is generated by the file people.md, which uses yaml entries for each member to render member items on the page, including a jpg photo, short description, affiliation and country. It is important that these entries are formatted without errors, as the page will not be generated otherwise, and the previous version will stay in place.

To avoid issues and a lot of manual labour, use the sripts in R/update_people.R. The current implementation works as follows:

  1. start R into reconhub.github.io/R/
  2. type source("update_people.R") to load functions
  3. add appropriate photos in img/people/[firstname]-[lastname].jpg
  4. type update_people_file() to generate a new people.md whose 'member' section will be built from the registration form; optionally, the script can check that required photos are in place, and add the default 'anonymous' photo if they are missing, by specifying: update_people_file(add_missing_pic = TRUE)
  5. Type git add ../img/people/ to add the new image files
  6. Commit and push as usual, e.g.
git commit -a -m "updating members"
git push

Functions of the script are roxygen-documented, but a copy of the main function's documentation is provided below:

#' This function generates a new, updated people.md
#'
#' The function will read the current people.md file, import membership data,
#' generate entries for all members in the registration spreadsheet, and insert
#' these new data in the 'people-list' section in a new, updated people.md
#' file. Note that if unsure, you can specify an alternative output file, so
#' that you can compare the old and new version to make sure nothing got
#' lost. In particular, make sure all members are recorded in the registration
#' spreadsheet, as only these will be present in the updated version. The
#' following additional changes are also made when processing entries of the
#' registration form: i) capitalisation of names is enforced (upper casde for
#' first letter, lower case for others) ii) names are converted to ASCII
#' characters (including for the path to photo files) iii) optionally, generic
#' 'anonymous' photos are placed in the right folder if the photo file is
#' missing (see argument `add_missing_pic`).
#'
#' @param in_file the file to be used as input, defaults to `people.md`
#'
#' @param out_file the file to be used as output, defaults to the same as
#'   `in_file` in which case the input file will be replaced by the new version.
#' 
#' @param add_missing_pic a logical indicating if a default 'anonymous' pic
#'   should be created to replace missing photos
#'
#' @author Thibaut Jombart