Skip to content

Commit

Permalink
Fixed JS code
Browse files Browse the repository at this point in the history
  • Loading branch information
latenitefilms committed Aug 2, 2023
1 parent 918e2ad commit affa065
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/scripts/generate-faq.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const fs = require('fs');
const path = require('path');

const { PAGE_NAME } = process.env;

const pageName = '${PAGE_NAME}';
const directoryPath = path.join(process.env.GITHUB_WORKSPACE, `docs/_includes/${pageName}`);
const outputFile = path.join(process.env.GITHUB_WORKSPACE, `docs/_includes/generated-${pageName}.md`);
const directoryPath = path.join(process.env.GITHUB_WORKSPACE, `docs/_includes/${PAGE_NAME}`);
const outputFile = path.join(process.env.GITHUB_WORKSPACE, `docs/_includes/generated-${PAGE_NAME}.md`);

try {
fs.readdir(directoryPath, async function (err, files) {
Expand Down Expand Up @@ -43,7 +43,7 @@ try {
lastInitial = currentInitial;
}

fileContent += `{{ include "${pageName}/${fileNameWithoutExtension}" }}\n\n`;
fileContent += `{{ include "${PAGE_NAME}/${fileNameWithoutExtension}" }}\n\n`;
});

// Remove the last extra line and '---'
Expand Down
18 changes: 7 additions & 11 deletions .github/scripts/generate-rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ const RSS = require('rss');
const MarkdownIt = require('markdown-it');
const cheerio = require('cheerio');

const { SITE_TITLE } = process.env;
const { SITE_URL } = process.env;

const siteTitle = '${SITE_TITLE}';
const siteUrl = '${SITE_URL}';
const { SITE_TITLE, SITE_URL } = process.env;

const md = new MarkdownIt({html: true});

Expand All @@ -19,7 +15,7 @@ function convertDateToRFC822(dateString) {
}

function generateUrl(title) {
return `${siteUrl}/#${title.toLowerCase().replace(/ /g, '-')}`;
return `${SITE_URL}/#${title.toLowerCase().replace(/ /g, '-')}`;
}

function entriesAreEqual(entry1, entry2) {
Expand All @@ -46,11 +42,11 @@ if (fs.existsSync('docs/rss.xml')) {
}

const feed = new RSS({
title: siteTitle,
description: `Latest News from ${siteTitle}`,
feed_url: `${siteUrl}/rss.xml`,
site_url: siteUrl,
generator: siteTitle,
title: SITE_TITLE,
description: `Latest News from ${SITE_TITLE}`,
feed_url: `${SITE_URL}/rss.xml`,
site_url: SITE_URL,
generator: SITE_TITLE,
pubDate: oldFeedItems.length > 0 ? oldFeedItems[0].date : new Date(),
});

Expand Down

0 comments on commit affa065

Please sign in to comment.