/acthpa-website

A website generator for the ACTHPA (www.acthpa.org)

Primary LanguageHTML

ACTHPA Website Generator

This is a static site generator for the ACTHPA website. It replaced the old Joomla site on 2020-01-16.

Contributing

If you notice a mistake on the website, please open an issue.

Contributing Content

We would love to have more contributors to the website content! Some suggestions as to where to start are:

  • Write up a story about a flying-related adventure you've had. We can add this to the Stories section.
  • Write up some advice on equipment, technique etc. We can add this to the Advice section.
  • At the end of a day of flying, write up a report. Where you flew, who was there, any key achivements. Add photos, links to tracklogs, etc. We can add this to the Past section.
  • If there's an upcoming event that we don't have in the 'Future' section, then add it. Write a headline, a description of the event, a teaser, and find a good image to represent the event.
  • Events automatically move from 'Future', to 'Now', to 'Past', but their description should be manually updated when this happens. For example, if a competition was upcoming, but has now been run, then the event's description should be updated for tense, and any results (especially of ACTHPA members) should be added.

So how to contribute? If you're just wanting to change some existing content then find that content (probably a .md file under the site/ directory and change it. If you want to add some content then the easiest way is to find some similar content and copy it. If you're technically savvy, then fork the repo, make your changes, commit them to your repo, then open up a pull request to have your changes merged into the main site repo. If the previous sentence is gibberish to you, or you otherwise can't figure out quite how to make the change, then just send the changed file, or your words and images in some format, to alex@farfromthere.net and I'll sort it out.

Contributing Code

Changes to the site's theme, content scraper or site generator are welcome. Just open up a new issue to discuss, or submit a pull request.

How it Works

The pages of the site are generated by the build-site executable from their MarkDown source files (the files ending in .md) in the site/ directory. These are combined with the html templates in the templates folder, using the Slick library via the Haskell source code in the build-site/ directory. There is also another executable, scrape, which scrapes content from other sites (such as XContest). This is output to the site/scraped/ directory and turned into variables that the MarkDown files can use, e.g. {{{longestCanberra}}}. The site resources in the site/css, site/js, and site/images folders are also used to bring the site together.

Building

To build, you will need either Haskell stack, or the Nix package manager.

To build with nix, follow these instructions.

To build with stack, run stack build scrape and stack build build-site.

Scraping Content

To scrape content (populating the site/scraped/ folder), currently only from xcontest.org:

cabal new-exec -- scrape

Generating the Site

To generate the site (in the gen/ subfolder), run:

cabal new-exec build-site

Or with stack:

stack exec build-site

Testing the Site

The site is best tested using a web server1, such as Nginx or Apache. Simply configure the web server to serve up the gen/ directory at e.g. http://acthpa.localhost.

Deploying the Site

To deploy the site, assuming you have ssh access to the web server, recursively rsync the gen/ folder to the server:

Footnotes

  1. The reason the site should be tested using a web server is that we use a bit of a hack to allow clean urls on this static site. The hack allows urls such as https;//acthpa.org/info to serve up a page by relying on the web server to automatically serve up index pages. The above url would then serve up a page from at /path/to/acthpa.org/info/index.html. But this clean url trick won't work if you simply view the static files under a file:// url.