diff --git a/extension/convert-to-sitemap.js b/extension/convert-to-sitemap.js index b73cdba..b182aef 100644 --- a/extension/convert-to-sitemap.js +++ b/extension/convert-to-sitemap.js @@ -19,19 +19,24 @@ function extConvertToSitemap(options) { } var siteMetadata = JSON.parse(fs.readFileSync(pagesPath, model_1.FILE_ENCODING)); var xml = ""; - function createUrlNode(metadata) { + function createUrlNode(file, metadata) { if (!!metadata.priority && metadata.priority < 0) { return ''; } if (metadata.blog) { - return "\n " + siteMetadata.url + "/blog/" + metadata.dir + "/" + metadata.filename + ".html\n " + moment(siteMetadata.revdate).format() + "\n 0.51\n "; + if (file.path.lastIndexOf("blog/") > 0) { + return "\n " + siteMetadata.url + "/blog/" + metadata.dir + "/" + metadata.filename + ".html\n " + moment(siteMetadata.revdate).format() + "\n 0.51\n "; + } + if (file.path.lastIndexOf("training/") > 0) { + return "\n " + siteMetadata.url + "/blog/" + metadata.dir + "/" + metadata.filename + ".html\n " + moment(siteMetadata.revdate).format() + "\n 0.51\n "; + } } return "\n " + siteMetadata.url + "/" + metadata.filename + ".html\n " + moment().format() + "\n " + (metadata.priority ? metadata.priority : 0.51) + "\n "; } var iterateOnStream = function (file, _, next) { var data = JSON.parse(file.contents); xml += data.length === 0 ? '' : data - .map(function (metadata) { return createUrlNode(metadata); }) + .map(function (metadata) { return createUrlNode(file, metadata); }) .reduce(function (a, b) { return a + b; }); next(null, file); }; diff --git a/extension/convert-to-sitemap.ts b/extension/convert-to-sitemap.ts index 0d17c66..8452974 100644 --- a/extension/convert-to-sitemap.ts +++ b/extension/convert-to-sitemap.ts @@ -24,16 +24,25 @@ export function extConvertToSitemap(options: Options): Transform { let xml = ``; - function createUrlNode(metadata) { + function createUrlNode(file, metadata) { if (!!metadata.priority && metadata.priority < 0) { return ''; } if (metadata.blog) { - return ` - ${siteMetadata.url}/blog/${metadata.dir}/${metadata.filename}.html - ${moment(siteMetadata.revdate).format()} - 0.51 - `; + if (file.path.lastIndexOf("blog/") > 0) { + return ` + ${siteMetadata.url}/blog/${metadata.dir}/${metadata.filename}.html + ${moment(siteMetadata.revdate).format()} + 0.51 + `; + } + if (file.path.lastIndexOf("training/") > 0) { + return ` + ${siteMetadata.url}/blog/${metadata.dir}/${metadata.filename}.html + ${moment(siteMetadata.revdate).format()} + 0.51 + `; + } } return ` ${siteMetadata.url}/${metadata.filename}.html @@ -45,7 +54,7 @@ export function extConvertToSitemap(options: Options): Transform { const iterateOnStream = function (file, _, next) { const data = JSON.parse(file.contents); xml += data.length === 0 ? '' : data - .map(metadata => createUrlNode(metadata)) + .map(metadata => createUrlNode(file, metadata)) .reduce((a, b) => a + b); next(null, file) }; diff --git a/src/blog/2018/test2.adoc b/src/blog/2018/test2.adoc index e235e89..d6db642 100644 --- a/src/blog/2018/test2.adoc +++ b/src/blog/2018/test2.adoc @@ -6,12 +6,13 @@ :category: Agilité :teaser: Test :imgteaser: ../../img/blog/2015/formes_leadership_00.jpg +:icons: font Test [source, java, subs="specialchars"] ---- -@RequestMapping("/api/hello") +@RequestMapping("/api/hello") // <1> class CallForPaperServiceTests { /** * Java comment