Clubs

The clubs page can only be edited in Code Editor mode as it contains JavaScript. It is initially configured for the Southern Federation.

It is quite tricky to edit directly so a page generator is provided for you. Download the file  map and edit it with a simple editor such as Notepad on Windows – don’t use MSWord. This file is in a format known as Json so you may also choose to use a dedicated Json editor such as https://jsoneditoronline.org/

The file starts with a list of “clubs” where each club has four fields: name, url, latitude and longitude. If the club does not nave its own website then just use the url of the web page for the club on the CA web site. The ordering of the clubs is not important as they will be sorted into alphabetical order for display. Each club starts with a “[” and ends with a “]”. Clubs are separated by a comma – so all clubs except the last need a comma at the end of the line after the “]”. Text fields must be in double quotes. To find the latitude and longitude of a club, locate it on google maps https://www.google.co.uk/maps. Then right click on the point you want and select “What’s here?”. A small window will appear with the latitude and longitude of the point. Click on that latitude and longitude and the numbers will appear near the top left of the main window from which they can be copied and pasted. You must use the decimal degrees rather than degrees, minutes and seconds.

Next is the “prolog” which if set  is a piece of text that will appear at the top of the page.

If “map” is true then the prolog will be followed by a map showing all the clubs.

The map will be centered at the centre of the clubs and will have a size determined by “zoom” which should typically be in the range 6.0 to 10.0 where a large number zooms in more.  Make sure that the map looks OK on a phone as well as a large screen.

The “key” must be set to your your key for the Google Map API which can be obtained as explained in: Initial setup for your federation

“between” is some optional text which comes after the map and before the list

If “list” is true you will get an alphabetical list of club links.

Finally the “epilog” is optional text to go at the bottom.

Save the file you have generated and go to the map generator. Click on the “Choose file” button and select the map file you have just created and then click the “Generate” button. If you get an error message please make the suggested correction and try again. Once you get it right a page of code will be displayed. Copy it all into the “paste buffer” – i.e. Ctrl-A, Ctrl-C on Windows.

Now edit the clubs page. It should normally contain one “Custom HTML” block. Select everything and overwrite the block with the contents of the paste buffer – i.e. Ctrl-A, Ctrl-V on windows. The “Preview Changes” button will list the clubs but not show the map. So just click “Update” and view the result.

To get the zoom parameter right you may choose to adjust it in the editor rather than repeating the process though it would be sensible once you have the correct zoom value to copy it back into your map.txt file and keep it carefully somewhere.

If you get a message “Sorry! Something went wrong. This page didn’t load Google Maps correctly. See the JavaScript console for technical details.” the most likely explanation is that you made an error with the  key for the Google Map API.  You may open the JavaScript console in your web browser. For Chrome this is Ctrl-Shift-i and then select the console tab.