Skip to content

Commit

Permalink
EES-5003 - Minor fixes (#4993)
Browse files Browse the repository at this point in the history
  • Loading branch information
sambiramairelogic committed Jun 21, 2024
1 parent d9345ca commit 382520f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/explore-education-statistics-frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ PUBLIC_API_DOCS_URL=TODO-GUIDANCE-URL
NOTIFICATION_API_BASE_URL=http://localhost:7073/api
GA_TRACKING_ID=
PUBLIC_URL=http://localhost:3000/
PROD_PUBLIC_URL=https://explore-education-statistics.service.gov.uk
APP_ENV=Local
1 change: 0 additions & 1 deletion src/explore-education-statistics-frontend/.env.production

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: process.env.PUBLIC_URL,
siteUrl: process.env.PROD_PUBLIC_URL,
sitemapSize: 5000,
exclude: ['/server-sitemap.xml'],
generateRobotsTxt: true,
Expand All @@ -16,7 +16,7 @@ module.exports = {
],
},
],
additionalSitemaps: [`${process.env.PUBLIC_URL}server-sitemap.xml`],
additionalSitemaps: [`${process.env.PROD_PUBLIC_URL}/server-sitemap.xml`],
},
transform: async (config, path) => {
if (path === '/') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function buildMethodologyRoutes(
methodologies: MethodologySitemapItem[],
): ISitemapField[] {
return methodologies.map(methodology => ({
loc: `${process.env.PUBLIC_URL}methodology/${methodology.slug}`,
loc: `${process.env.PROD_PUBLIC_URL}/methodology/${methodology.slug}`,
lastmod: methodology.lastModified,
}));
}
Expand All @@ -47,28 +47,28 @@ function buildPublicationRoutes(
fields.push(
...[
{
loc: `${process.env.PUBLIC_URL}data-catalogue/${publication.slug}`,
loc: `${process.env.PROD_PUBLIC_URL}/data-catalogue/${publication.slug}`,
lastmod: publication.lastModified,
},
// TODO: Check if data-tables should be included in the sitemap
// Add <noindex, nofollow> to the data-tables page if not
// Add to robots.txt if not
// {
// loc: `${process.env.PUBLIC_URL}data-tables/${publication.slug}`,
// loc: `${process.env.PROD_PUBLIC_URL}/data-tables/${publication.slug}`,
// lastmod: publication.lastModified,
// },
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}`,
lastmod: publication.lastModified,
priority: 0.7,
},
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}/data-guidance`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}/data-guidance`,
lastmod: publication.lastModified,
priority: 0.4,
},
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}/prerelease-access-list`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}/prerelease-access-list`,
lastmod: publication.lastModified,
priority: 0.2,
},
Expand All @@ -78,28 +78,28 @@ function buildPublicationRoutes(
fields.push(
...[
{
loc: `${process.env.PUBLIC_URL}data-catalogue/${publication.slug}`,
loc: `${process.env.PROD_PUBLIC_URL}/data-catalogue/${publication.slug}`,
lastmod: publication.lastModified,
},
// TODO: Check if data-tables should be included in the sitemap
// Add <noindex, nofollow> to the data-tables page if not
// Add to robots.txt if not
// {
// loc: `${process.env.PUBLIC_URL}data-tables/${publication.slug}`,
// loc: `${process.env.PROD_PUBLIC_URL}/data-tables/${publication.slug}`,
// lastmod: publication.lastModified,
// },
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}`,
lastmod: publication.lastModified,
priority: 0.7,
},
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}/data-guidance`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}/data-guidance`,
lastmod: publication.lastModified,
priority: 0.4,
},
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}/prerelease-access-list`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}/prerelease-access-list`,
lastmod: publication.lastModified,
priority: 0.2,
},
Expand All @@ -110,28 +110,28 @@ function buildPublicationRoutes(
fields.push(
...[
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}/${release.slug}`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}/${release.slug}`,
lastmod: release.lastModified,
},
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}/${release.slug}/data-guidance`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}/${release.slug}/data-guidance`,
lastmod: release.lastModified,
priority: 0.4,
},
{
loc: `${process.env.PUBLIC_URL}find-statistics/${publication.slug}/${release.slug}/prerelease-access-list`,
loc: `${process.env.PROD_PUBLIC_URL}/find-statistics/${publication.slug}/${release.slug}/prerelease-access-list`,
lastmod: release.lastModified,
priority: 0.2,
},
{
loc: `${process.env.PUBLIC_URL}data-catalogue/${publication.slug}/${release.slug}`,
loc: `${process.env.PROD_PUBLIC_URL}/data-catalogue/${publication.slug}/${release.slug}`,
lastmod: release.lastModified,
},
// TODO: Check if data-tables should be included in the sitemap
// Add <noindex, nofollow> to the data-tables page if not
// Add to robots.txt if not
// {
// loc: `${process.env.PUBLIC_URL}data-tables/${publication.slug}/${release.slug}`,
// loc: `${process.env.PROD_PUBLIC_URL}/data-tables/${publication.slug}/${release.slug}`,
// lastmod: release.lastModified,
// },
],
Expand All @@ -147,7 +147,7 @@ function buildPublicationRoutes(
// dataSets: DataSetSitemapItem[],
// ): ISitemapField[] {
// return dataSets.map(dataSet => ({
// loc: `${process.env.PUBLIC_URL}data-catalogue/data-set/${dataSet.id}`,
// loc: `${process.env.PROD_PUBLIC_URL}/data-catalogue/data-set/${dataSet.id}`,
// lastmod: dataSet.lastModified,
// }));
// }
5 changes: 4 additions & 1 deletion tests/playwright-tests/tests/public/seoMetadataFiles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import environment from '@util/env';

const { PUBLIC_URL, PROD_PUBLIC_URL } = environment;

test.describe('SEO Metadata Files', () => {
// Playwright finds two elements with getByText('...sitemal.xml') because the html span they're displayed
// in contains the xml <loc> tag, which playwright then treats as another html element.
// TODO: Either resolve this, or re-create these tests in robot if the team prefers
test.describe.skip('SEO Metadata Files', () => {
test('An xml sitemap index file can be found at the expected route', async ({
page,
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Verify that routes with www are redirected without them
user waits until page contains Explore education statistics
user checks url equals %{PUBLIC_URL}/

user navigates to public frontend %{PUBLIC_URL_WITH}/data-catalogue/
user navigates to public frontend with www %{PUBLIC_URL}/data-catalogue/
user waits until page contains Browse our open data
user checks url equals %{PUBLIC_URL}/data-catalogue

Expand Down
2 changes: 1 addition & 1 deletion tests/robot-tests/tests/general_public/redirects_www.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Verify that routes with www are redirected without them
user waits until page contains Explore education statistics
user checks url equals %{PUBLIC_URL}/

user navigates to public frontend %{PUBLIC_URL_WITH}/data-catalogue/
user navigates to public frontend with www %{PUBLIC_URL}/data-catalogue/
user waits until page contains Browse our open data
user checks url equals %{PUBLIC_URL}/data-catalogue

0 comments on commit 382520f

Please sign in to comment.