Skip to content

KakeLP/map-site-maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MapSite - A set of tools for turning datafiles into a map-enabled website
based on static HTML and Javascript.


* Put your Flickr key and secret in conf/flickr.conf
Keep this secret!  Do not share it with anyone!


* Put other variables in conf/mapsite.conf.  In the root section:

base_url = the root URL of the site, e.g. https://londonbookshops.org/

datafile = the location of the datafile, e.g. /home/kake/data/bookshops.yaml
(note that currently this must be a YAML file)

default_category = a single lowercase word (if not specified, this defaults
to "open").  See below for more on categories.

entity_type = a single word (underscores/hyphens allowed) that describes
the type of thing you're modelling in the plural (e.g. "shops", "pubs").
This is used to form URLs e.g. https://londonbookshops.org/shops/gosh.html

kml_filename = a filename for the KML that will be generated
(e.g. bookshops.kml).  This will default to $entity_type.kml

site_description = a sentence or two describing the site.  This is used
in e.g. the meta element in the header.  Defaults to something generic.
You probably want to put a full stop at the end.

site_name = a pretty title for the site, e.g. London Bookshop Map

sort_by_id = set this to 1 to sort by ID instead of name when listing your
shops/pubs/whatever

show_hide_all_cats_link = set this to 1 to add links for showing/hiding all
categories to the map display (mainly useful for sites with many categories)


* Categories

For now, each entity should be in one and only one category.  Categories are
defined in the config file in a [categories] section, e.g.

[categories]
closed = closed permanently
open = still in existence

and you can colour their markers selectively like so:

[category_colours]
closed = red
open = green

Colours are defined in main.css; with the default main.css included in this
distribution, your options are black, blue, brown, coral, dkblue, dkbrown,
dkgreen, dkgrey, dkorange, dkpurple, dkred, fuchsia, gold, green, grey,
ltblue, ltgreen, ltpink, ltpurple, orange, peach, pink, purple, red, sage,
silver, teal, turquoise, white, and yellow.

If you have more categories than colours, you can append "-dot" to a colour
to get a circular dot added to the markers for that category:

[category_colours]
cafe = brown
restaurant = brown-dot

* Links

The [links] section of the config file maps datafile keys to names of
websites, e.g.

[links]
diamondgeezer = diamond geezer article
readingmatters = Reading Matters review
whatpub = WhatPub entry
yelp = Yelp comments

Then in your datafile you'll have e.g.
diamondgeezer: https://diamondgeezer.blogspot.co.uk/2013/04/woolfson-tay.html

which will be transformed into
<a href="https://diamondgeezer.blogspot.co.uk/2013/04/woolfson-tay.html">diamond
geezer article</a>
in the site HTML.


* To amend the templates, create a directory called custom_templates/, copy
the templates you want to amend from templates/ to custom_templates/, and
edit the copies in custom_templates/.  (Things in templates/ may get
overwritten when you upgrade the mapsite maker.)


* To add extra things to the <head> element of each page, create a template
called custom_header_insert.tt and put it in custom_templates/ .  This will
be added to the very end of the <head> on each page.  You might want this
to define webfonts, for example.


* To amend the CSS, edit main.css in assets/css/


* If you want anything copied over directly to the site, put it in static/
Note that if you use filenames the same as generated files, the static files
will be overwritten in site/ with the generated ones.  Similarly, if you
use any filenames used in assets/ then your files will be overwritten in site/.
Note also that this doesn't exclude e.g. emacs backup files - it just copies
them over like any other file.


* The site will be generated in site/ - every time you run "generate", this
directory will be created if necessary and cleared out if necessary.


* This code has some associated tests.  Some of these tests require a valid
Flickr key and secret.  If you want to run these tests, set an environment
variable MAPSITE_FLICKR_CONF pointing to the location of your flickr.conf
(if this variable isn't set, the tests will just be skipped).  Do note that
these tests may take a while to run, particularly if the Flickr API is being
slow.  An attempt is made to detect whether the API is unavailable (if so,
the tests will be skipped), but this isn't 100% reliable so you may get
spurious test failures.


About

The code that makes londonbookshops.org, made generic.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published