Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ekoeryanto/vuepress-plugin-sitemap
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.3.0
Choose a base ref
...
head repository: ekoeryanto/vuepress-plugin-sitemap
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.3.1
Choose a head ref
  • 7 commits
  • 6 files changed
  • 1 contributor

Commits on Oct 20, 2019

  1. Verified

    This commit was signed with the committer’s verified signature.
    heifner Kevin Heifner
    Copy the full SHA
    a5c4b10 View commit details
  2. Copy the full SHA
    2fe9990 View commit details

Commits on Oct 29, 2019

  1. chore: add credits

    ekoeryanto committed Oct 29, 2019
    Copy the full SHA
    376895f View commit details

Commits on Nov 8, 2019

  1. fix: base config ignored

    fixes #26
    ekoeryanto authored Nov 8, 2019
    Copy the full SHA
    f3648c3 View commit details
  2. fix: wrong temp dir path

    ekoeryanto committed Nov 8, 2019
    Copy the full SHA
    5352720 View commit details
  3. Copy the full SHA
    7224d57 View commit details
  4. Copy the full SHA
    f89e37c View commit details
Showing with 47 additions and 4 deletions.
  1. +9 −0 CHANGELOG.md
  2. +21 −0 LICENSE
  3. +3 −0 README.md
  4. +3 −0 cli.js
  5. +10 −3 index.js
  6. +1 −1 package.json
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<a name="2.3.1"></a>
## [2.3.1](https://github.com/ekoeryanto/vuepress-plugin-sitemap/compare/v2.3.0...v2.3.1) (2019-11-08)


### Bug Fixes

* base config ignored ([f3648c3](https://github.com/ekoeryanto/vuepress-plugin-sitemap/commit/f3648c3)), closes [#26](https://github.com/ekoeryanto/vuepress-plugin-sitemap/issues/26)
* wrong temp dir path ([5352720](https://github.com/ekoeryanto/vuepress-plugin-sitemap/commit/5352720))

<a name="2.3.0"></a>
# [2.3.0](https://github.com/ekoeryanto/vuepress-plugin-sitemap/compare/v2.2.0...v2.3.0) (2019-10-20)

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Eko Eryanto

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -116,3 +116,6 @@ Other options of [sitemap](https://npm.im/sitemap) can be used, all options pass
## Related Plugins

* [Server Push Links Generator](https://github.com/ekoeryanto/vuepress-plugin-server-push)

## Credits
* [JetBrains s.r.o](https://www.jetbrains.com/?from=vuepress-plugin-sitemap)
3 changes: 3 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -35,6 +35,9 @@ try {
tempDir = existsSync(legacyTempDir)
? legacyTempDir
: resolve('node_modules/@vuepress/core/.temp/internal')
} else {
const stableDir = resolve(tempDir, 'internal')
tempDir = existsSync(stableDir) ? stableDir : resolve(tempDir)
}

const siteDataFile = resolve(tempDir, 'siteData.js')
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -36,10 +36,12 @@ module.exports = (options, context) => {

log('Generating sitemap...')

const { pages, locales } = context.getSiteData
const { pages, locales, base } = context.getSiteData
? context.getSiteData()
: context

const withBase = url => base.replace(/\/$/, '') + url

// Sort the locale keys in reverse order so that longer locales, such as '/en/', match before the default '/'
const localeKeys = (locales && Object.keys(locales).sort().reverse()) || []
const localesByNormalizedPagePath = pages.reduce((map, page) => {
@@ -75,7 +77,7 @@ module.exports = (options, context) => {
links = relatedLocales.map(localePrefix => {
return {
lang: locales[localePrefix].lang,
url: normalizedPath.replace('/', localePrefix)
url: withBase(normalizedPath.replace('/', localePrefix))
}
})
}
@@ -100,7 +102,12 @@ module.exports = (options, context) => {
})

pagesMap.forEach((page, url) => {
if (!exclude.includes(url)) sitemap.add({ url, ...page })
if (!exclude.includes(url)) {
sitemap.add({
url: withBase(url),
...page
})
}
})

urls.forEach(item => {
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuepress-plugin-sitemap",
"version": "2.3.0",
"version": "2.3.1",
"description": "Sitemap generator plugin for vuepress",
"main": "index.js",
"bin": {