portaljs icon indicating copy to clipboard operation
portaljs copied to clipboard

Improve PortalJS template's SEO features

Open anuveyatsu opened this issue 6 months ago • 2 comments

I think it doesn't work very well when it comes to SEO features in the PortalJS template:

  • Basic meta titles, descriptions, canonical urls.
  • Open Graph attributes
  • Structured data, eg, see here for datasets https://developers.google.com/search/docs/appearance/structured-data/dataset
    • Home page -> website or DataCatalog
    • Search page -> DataCatalog
    • Dataset page -> Dataset
    • Resource page -> DataDownload ?

Tasks

  • [x] Fix duplicate URL for dataset pages. See https://github.com/datopian/portaljs-frontend-starter/pull/16
  • [x] Implement basic SEO attributes
    • [x] Ensure it has a central SEO config file where we export default metadata (site name, default title template, description, openGraph defaults, twitter defaults). We currently have https://github.com/datopian/portaljs-frontend-starter/blob/main/next-seo.config.js but need to double check if it is being used and then need to expand it as it looks incomplete, e.g., no Twitter card attributes + values should be updated to reflect PortalJS project.
    • [x] Home page: use NextSEO instead of Head – https://github.com/datopian/portaljs-frontend-starter/blob/main/pages/index.tsx#L42-L46
    • [x] Organizations page: ditto – https://github.com/datopian/portaljs-frontend-starter/blob/main/pages/organizations.tsx#L27-L31 and https://github.com/datopian/portaljs-frontend-starter/blob/main/pages/organizations.tsx#L47-L50
    • [x] Search page: https://github.com/datopian/portaljs-frontend-starter/blob/main/pages/search.tsx#L49-L52
    • [x] Individual org page: https://github.com/datopian/portaljs-frontend-starter/blob/main/pages/%5Borg%5D/index.tsx#L75-L79
    • [x] Dataset page: https://github.com/datopian/portaljs-frontend-starter/blob/main/pages/%5Borg%5D/%5Bdataset%5D/index.tsx#L82-L86
    • [x] Resource page: find the code snippet and implement.
    • [x] Groups page
    • [x] Individual group page
    • [x] Make sure meta tags are not being overriding in components / layouts further down. It must be defined in one single place, preferably in a page code.
  • [x] Implement structured data (aka search rich results / schema.org):
    • [x] Search page -> DataCatalog
    • [x] Dataset page -> Dataset
    • [x] Resource page -> DataDownload
  • [x] Validate the org name in dataset page

anuveyatsu avatar Jun 05 '25 07:06 anuveyatsu

@anuveyatsu I realized there is another page duplication issue with datasets and resources

On the dataset and resources route, the org name is not validated, so there are infinite possible routes for one dataset or resource.

For example, https://data.hounslow.gov.uk/this-org-does-not-exist/register-of-licensed-hmos, https://data.hounslow.gov.uk/this-org-does-not-exist-2/register-of-licensed-hmos

Already fixing this on Honslow, but might be good to do it on the template as well.

demenech avatar Jun 12 '25 16:06 demenech

PR is here https://github.com/datopian/portaljs-frontend-starter/pull/19

anuveyatsu avatar Jun 20 '25 10:06 anuveyatsu