From dedf400ea87480d047b636b99e747fa3adbdc260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Sun, 22 Mar 2020 20:07:11 +0100 Subject: [PATCH] Fix things --- src/routes/location/[country]/[place].svelte | 2 +- src/routes/sitemap.xml.js | 18 ++++++++++-------- src/style/organisms/_photos.scss | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/routes/location/[country]/[place].svelte b/src/routes/location/[country]/[place].svelte index e65f2cf..e85e70e 100644 --- a/src/routes/location/[country]/[place].svelte +++ b/src/routes/location/[country]/[place].svelte @@ -7,7 +7,7 @@ const fields = [ 'id', 'name', 'slug', 'date', 'image.*', 'location.id', 'location.name', 'location.slug', 'location.region', 'location.country.name', 'location.country.slug', - 'created_on' + 'created_on', 'modified_on' ].join(',') const sort = ['-created_on', 'name'].join(',') const limit = -1 diff --git a/src/routes/sitemap.xml.js b/src/routes/sitemap.xml.js index d6b786a..07180d3 100644 --- a/src/routes/sitemap.xml.js +++ b/src/routes/sitemap.xml.js @@ -4,10 +4,10 @@ import { apiEndpoints } from '../utils/store' // Variables -let BASE_URL +let baseURL const pages = [''] -// Get each route +// Get routes and push it to array fs.readdirSync('./src/routes').forEach(file => { const filename = file.split('.')[0] if (!file.startsWith('.') && !filename.startsWith('_') && ['sitemap', 'index', 'location', 'viewer'].indexOf(filename) === -1) { @@ -15,10 +15,9 @@ fs.readdirSync('./src/routes').forEach(file => { } }) + // Render function const render = (pages, locations) => { - console.log(locations) - return ` { > ${pages.map(page => ` - ${BASE_URL}/${page} + ${baseURL}/${page} 0.75 `).join('\n')} ${locations.map(loc => ` - ${BASE_URL}/location/${loc.country.slug}/${loc.slug} + ${baseURL}/location/${loc.country.slug}/${loc.slug} 1 `).join('\n')} ` @@ -41,15 +40,18 @@ const render = (pages, locations) => { // Get function export async function get (req, res, next) { - BASE_URL = `http${(req.httpVersion >= 2) ? 's' : ''}://${req.headers.host}` + // Define base url from request + baseURL = `http${(req.httpVersion >= 2) ? 's' : ''}://${req.headers.host}` // Get locations const locationsReq = await fetch(`${apiEndpoints.rest}/items/locations?fields=slug,country.slug`) const locations = await locationsReq.json() - res.setHeader('Cache-Control', `max-age=0, s-max-age=${600}`) // 10 minutes + // Set headers + res.setHeader('Cache-Control', 'max-age=0, s-max-age=600') // 10 minutes res.setHeader('Content-Type', 'application/rss+xml') + // Render sitemap const sitemap = render(pages, locations.data) res.end(sitemap) } diff --git a/src/style/organisms/_photos.scss b/src/style/organisms/_photos.scss index 6323b5a..cc2829e 100644 --- a/src/style/organisms/_photos.scss +++ b/src/style/organisms/_photos.scss @@ -1,7 +1,6 @@ .photos { position: relative; margin-top: -22px; - overflow-x: hidden; background-color: #fff; @include breakpoint (sm) { @@ -55,6 +54,7 @@ position: relative; z-index: 4; margin-bottom: 88px; + overflow-x: hidden; @include breakpoint (sm) { margin-bottom: 120px;