Liquid Testing Site

TO DO:

-Make a bootstrap accordian with the regions

-11ty/liquid includes and base templates

-Default to the region I am in, using CF worker (request.cf.country)

-Move the worker code to the pages site (funtions dir) and use git push to deploy

-Create production site using test code

Raw JSON data:

This code interpolates the bankHolidays variable as a JSON string. The jsonify filter then formats the code into JSON.


{
    "england-and-wales": {
        "division": "england-and-wales",
        "events": [
            {
                "title": "Christmas Day",
                "date": "2024-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2024-12-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "New Year’s Day",
                "date": "2025-01-01",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Good Friday",
                "date": "2025-04-18",
                "notes": "",
                "bunting": false
            },
            {
                "title": "Easter Monday",
                "date": "2025-04-21",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Early May bank holiday",
                "date": "2025-05-05",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Spring bank holiday",
                "date": "2025-05-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Summer bank holiday",
                "date": "2025-08-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Christmas Day",
                "date": "2025-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2025-12-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "New Year’s Day",
                "date": "2026-01-01",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Good Friday",
                "date": "2026-04-03",
                "notes": "",
                "bunting": false
            },
            {
                "title": "Easter Monday",
                "date": "2026-04-06",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Early May bank holiday",
                "date": "2026-05-04",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Spring bank holiday",
                "date": "2026-05-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Summer bank holiday",
                "date": "2026-08-31",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Christmas Day",
                "date": "2026-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2026-12-28",
                "notes": "Substitute day",
                "bunting": true
            }
        ]
    },
    "scotland": {
        "division": "scotland",
        "events": [
            {
                "title": "St Andrew’s Day",
                "date": "2024-12-02",
                "notes": "Substitute day",
                "bunting": true
            },
            {
                "title": "Christmas Day",
                "date": "2024-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2024-12-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "New Year’s Day",
                "date": "2025-01-01",
                "notes": "",
                "bunting": true
            },
            {
                "title": "2nd January",
                "date": "2025-01-02",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Good Friday",
                "date": "2025-04-18",
                "notes": "",
                "bunting": false
            },
            {
                "title": "Early May bank holiday",
                "date": "2025-05-05",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Spring bank holiday",
                "date": "2025-05-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Summer bank holiday",
                "date": "2025-08-04",
                "notes": "",
                "bunting": true
            },
            {
                "title": "St Andrew’s Day",
                "date": "2025-12-01",
                "notes": "Substitute day",
                "bunting": true
            },
            {
                "title": "Christmas Day",
                "date": "2025-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2025-12-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "New Year’s Day",
                "date": "2026-01-01",
                "notes": "",
                "bunting": true
            },
            {
                "title": "2nd January",
                "date": "2026-01-02",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Good Friday",
                "date": "2026-04-03",
                "notes": "",
                "bunting": false
            },
            {
                "title": "Early May bank holiday",
                "date": "2026-05-04",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Spring bank holiday",
                "date": "2026-05-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Summer bank holiday",
                "date": "2026-08-03",
                "notes": "",
                "bunting": true
            },
            {
                "title": "St Andrew’s Day",
                "date": "2026-11-30",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Christmas Day",
                "date": "2026-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2026-12-28",
                "notes": "Substitute day",
                "bunting": true
            }
        ]
    },
    "northern-ireland": {
        "division": "northern-ireland",
        "events": [
            {
                "title": "Christmas Day",
                "date": "2024-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2024-12-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "New Year’s Day",
                "date": "2025-01-01",
                "notes": "",
                "bunting": true
            },
            {
                "title": "St Patrick’s Day",
                "date": "2025-03-17",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Good Friday",
                "date": "2025-04-18",
                "notes": "",
                "bunting": false
            },
            {
                "title": "Easter Monday",
                "date": "2025-04-21",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Early May bank holiday",
                "date": "2025-05-05",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Spring bank holiday",
                "date": "2025-05-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Battle of the Boyne (Orangemen’s Day)",
                "date": "2025-07-14",
                "notes": "Substitute day",
                "bunting": false
            },
            {
                "title": "Summer bank holiday",
                "date": "2025-08-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Christmas Day",
                "date": "2025-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2025-12-26",
                "notes": "",
                "bunting": true
            },
            {
                "title": "New Year’s Day",
                "date": "2026-01-01",
                "notes": "",
                "bunting": true
            },
            {
                "title": "St Patrick’s Day",
                "date": "2026-03-17",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Good Friday",
                "date": "2026-04-03",
                "notes": "",
                "bunting": false
            },
            {
                "title": "Easter Monday",
                "date": "2026-04-06",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Early May bank holiday",
                "date": "2026-05-04",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Spring bank holiday",
                "date": "2026-05-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Battle of the Boyne (Orangemen’s Day)",
                "date": "2026-07-13",
                "notes": "Substitute day",
                "bunting": false
            },
            {
                "title": "Summer bank holiday",
                "date": "2026-08-31",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Christmas Day",
                "date": "2026-12-25",
                "notes": "",
                "bunting": true
            },
            {
                "title": "Boxing Day",
                "date": "2026-12-28",
                "notes": "Substitute day",
                "bunting": true
            }
        ]
    }
} 

UK Bank Holidays (Table):

A conditional checks the bankHolidays object for relavent data, then that data is iterated over and table rows are created to display the data.
Meanwhile, the lastYear variable is set as an empty string, and is then checked aganst the current year of the holiday and if different, a new row is created with data that displays the year. The variable is then set to the current year before starting the next iteration.

Date Title Notes Bunting
2024
2024-12-25 Christmas Day None true
2024-12-26 Boxing Day None true
2025
2025-01-01 New Year’s Day None true
2025-04-18 Good Friday None false
2025-04-21 Easter Monday None true
2025-05-05 Early May bank holiday None true
2025-05-26 Spring bank holiday None true
2025-08-25 Summer bank holiday None true
2025-12-25 Christmas Day None true
2025-12-26 Boxing Day None true
2026
2026-01-01 New Year’s Day None true
2026-04-03 Good Friday None false
2026-04-06 Easter Monday None true
2026-05-04 Early May bank holiday None true
2026-05-25 Spring bank holiday None true
2026-08-31 Summer bank holiday None true
2026-12-25 Christmas Day None true
2026-12-28 Boxing Day Substitute day true

UK Bank Holidays (Accordian):

Data is fetched from the Gov.uk API using a cloudflare worker that iterates through the data and filters out past events. They are then arranged by year and placed in the corresponding country's container within a Bootstrap accordian element.