codeforamerica / rva

Team Richmond's writing & project information
http://rva.codeforamerica.org
2 stars 5 forks source link

How to edit the site and add a new page on rva.codeforamerica.org with jekyll #16

Closed mapsam closed 9 years ago

mapsam commented 9 years ago

rva.codeforamerica.org is running on Github pages, which are powered by Jekyll. Below are some How-to's and extra information for installation, editing the site, and making new pages.

Install & running Jekyll

Jekyll can be installed on your computer following these instructions from @codeforamerica

Once installed successfully, cd into your project directory and run jekyll serve --watch which will make your site available at localhost:4000 and continue to watch for changing files. *Note: if you are changing information in the _config.yml you will need to rebuild the site by canceling the current process and re-running it.

Site Architecture

Jekyll uses the _ for all of the "working" directories, such as _includes/. These are modular files that are used in the _layouts/ directory. You'll see a _site directory on your computer (not followed by .gitignore) and that is technically where the static HTML is generated by Jekyll.

We have two "layouts" currently, home.html and default.html. Home is a unique one for two reasons:

  1. we currently don't use the _includes/footer.html file since it is not in the design, and
  2. there is a loop that looks through all the pages and their weight (see below) to order in the list. Currently we only have February Reflections

    Pages, current and new

All of the pages are accessed in their own directory. For example, our February Reflections page is located in the february/ directory (where the URL name comes from). This directory includes an index.html page, just like any HTML structure.

Each index page, you'll notice, has a bit of YAML at the top to designate specific information for jekyll to build properly. Our pages have four pieces:


---
layout: default #specifies the layout for this page to use
title: February Reflections #name of the page, used on homepage
weight: 1 #weight designates the order in which to grab this page in a loop
header_img: 'header_murals_innerglow2.jpg' #header image to use

---

Adding a new page Add a new page by creating a new root-level directory and adding an index.html file with the YAML at the top.

Why aren't we using _posts functionality?

Right now we're not really blogging. Also, the _posts feature is particularly useful when writing in markdown, but our site currently has a design that makes using markdown difficult (i.e. <aside>, <figure>, and combination of full-width images and containers) because of some needed HTML characters that aren't available in markdown syntax.