-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/issue 1232 static sitemap (#1240)
* #1232 - Adding default static sitemap plugin * 1232 - Adding meta files documentation * update meta files docs and usage examples --------- Co-authored-by: Owen Buckley <owenbuckley13@gmail.com>
- Loading branch information
1 parent
294a02e
commit 957a780
Showing
5 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { checkResourceExists } from '../../lib/resource-utils.js'; | ||
|
||
const greenwoodPluginCopySitemap = [{ | ||
type: 'copy', | ||
name: 'plugin-copy-sitemap', | ||
provider: async (compilation) => { | ||
const fileName = 'sitemap.xml'; | ||
const { outputDir, userWorkspace } = compilation.context; | ||
const sitemapPathUrl = new URL(`./${fileName}`, userWorkspace); | ||
const assets = []; | ||
|
||
if (await checkResourceExists(sitemapPathUrl)) { | ||
assets.push({ | ||
from: sitemapPathUrl, | ||
to: new URL(`./${fileName}`, outputDir) | ||
}); | ||
} | ||
|
||
return assets; | ||
} | ||
}]; | ||
|
||
export { greenwoodPluginCopySitemap }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/cli/test/cases/build.default.meta-files/src/sitemap.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
<url> | ||
<loc>https://www.example.com/</loc> | ||
<lastmod>2024-06-04T00:00:00Z</lastmod> | ||
<priority>1.0</priority> | ||
</url> | ||
|
||
<url> | ||
<loc>https://www.example.com/about/</loc> | ||
<lastmod>2023-12-15T16:20:00Z</lastmod> | ||
<priority>0.8</priority> | ||
</url> | ||
|
||
<url> | ||
<loc>https://www.example.com/contact/</loc> | ||
|
||
<priority>0.5</priority> | ||
</url> | ||
</urlset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters