Skip to content

Commit

Permalink
version 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipinho committed Dec 26, 2023
1 parent 89f48ae commit a5ee785
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion generate-sitemap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const knex = require("knex");
const knexConfig = require('./config');
const path = require("path");
const db = knex(knexConfig);

async function generateSitemap() {
Expand Down Expand Up @@ -39,7 +40,13 @@ async function generateSitemap() {

sitemap += '</urlset>';

fs.writeFileSync('static/sitemap.xml', sitemap, 'utf-8');
const directoryPath = path.join(__dirname, 'static');

if (!fs.existsSync(directoryPath)){
fs.mkdirSync(directoryPath, { recursive: true });
}

fs.writeFileSync(path.join(directoryPath, 'sitemap.xml'), sitemap, 'utf-8');
}

await db.destroy();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wikijs-sitemap",
"version": "1.0.2",
"version": "1.0.3",
"description": "Sitemap for Wiki.js",
"main": "server.js",
"scripts": {
Expand Down

0 comments on commit a5ee785

Please sign in to comment.