unicef / iogt

BSD 2-Clause "Simplified" License
25 stars 35 forks source link

In /sitemap/, reflect different Page types as different JSON objects #1200

Open cbunicef opened 2 years ago

cbunicef commented 2 years ago

Currently all Page types are combined on the /sitemap/ into a single JSON object in views.py.

[
    "https://www.internetofgoodthings.org/en/",
    "https://www.internetofgoodthings.org/ar/",
    "https://www.internetofgoodthings.org/fr/",
    "https://www.internetofgoodthings.org/es/",
    "https://www.internetofgoodthings.org/pt/",
    "https://www.internetofgoodthings.org/ru/",
    "https://www.internetofgoodthings.org/en/sections/covid-19/",
    ...
]

It would be more useful to break them down individually by Page type, as

{
    "Homepage":[
        "https://www.internetofgoodthings.org/en/",
        "https://www.internetofgoodthings.org/ar/",
        "https://www.internetofgoodthings.org/fr/",
        "https://www.internetofgoodthings.org/es/",
        "https://www.internetofgoodthings.org/pt/",
        "https://www.internetofgoodthings.org/ru/"
    ],
    "Section":[
        "https://www.internetofgoodthings.org/en/sections/covid-19/",
        ...
    ],
    ...
}
MgowanoJr commented 2 years ago

In future milestones, for flexibility in applying filters to the endpoint, we could consider using objects with properties instead like in the example below:

[ { "path": "https://www.internetofgoodthings.org/en/", "title": "Home Page", "pageType": "homepage", "parent": "/", "level": 1 }, { "path": "https://www.internetofgoodthings.org/en/sections/covid-19/", "title": "COVID 19 Resources", "pageType": "section", "parent": "https://www.internetofgoodthings.org/en/", "level": 3 } ]

But at the moment we can group the paths by Page type until further review