From a623371fd600a1f5de5f0c6f9a0a400abb46cfff Mon Sep 17 00:00:00 2001 From: Mats Bovin Date: Tue, 22 Oct 2024 12:59:25 +0200 Subject: [PATCH] Tweak sitemap generation --- .../au/org/ala/bie/SitemapService.groovy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/grails-app/services/au/org/ala/bie/SitemapService.groovy b/grails-app/services/au/org/ala/bie/SitemapService.groovy index 0aeca0d..814e6b5 100644 --- a/grails-app/services/au/org/ala/bie/SitemapService.groovy +++ b/grails-app/services/au/org/ala/bie/SitemapService.groovy @@ -32,13 +32,13 @@ class SitemapService{ Locale defaultLocale - String URLSET_HEADER = "" + String URLSET_HEADER = "" String URLSET_FOOTER = "" // Batch size for solr queries/commits and page sizes static BATCH_SIZE = 5000 - int MAX_URLS = 50000 // maximum number of URLs in a sitemap file + int MAX_URLS = 10000 // maximum number of URLs in a sitemap file int MAX_SIZE = 9*1024*1024 // use 9MB to keep the actual file size below 10MB (a gateway limit) File currentFile @@ -72,7 +72,7 @@ class SitemapService{ // write parent sitemap file fw = new FileWriter(grailsApplication.config.sitemap.dir + "/sitemap.xml") - fw.write("") + fw.write("\n") for (int i=0;i" + grailsApplication.config.grails.serverURL + '/sitemap' + i + ".xml" + "") - fw.write("" + simpleDateFormat.format(new Date()) + "") + // SBDI: Should be 'loc' and not 'url'. Serve sitemap without /ws path. + fw.write("" + grailsApplication.config.getProperty('bie.baseURL') + '/sitemap' + i + ".xml" + "") + fw.write("" + simpleDateFormat.format(new Date()) + "\n") } fw.write("") @@ -99,7 +99,7 @@ class SitemapService{ fw = new FileWriter(currentFile) - fw.write(URLSET_HEADER) + fw.write(URLSET_HEADER + "\n") countUrls = 0 fileCount++ @@ -173,7 +173,7 @@ class SitemapService{ fw.write("" + encodedUrl + "") fw.write("" + simpleDateFormat.format(new Date()) + "") fw.write("" + changefreq + "") - fw.write("") + fw.write("\n") fw.flush()