mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Minor improvements
This commit is contained in:
parent
bdf043027d
commit
9f746dc8d1
1 changed files with 11 additions and 18 deletions
|
@ -35,7 +35,6 @@ md.use(require("markdown-it-anchor"), { "level": 2, "permalink": true, "permalin
|
||||||
md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" });
|
md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" });
|
||||||
md.use(require('markdown-it-title'));
|
md.use(require('markdown-it-title'));
|
||||||
|
|
||||||
|
|
||||||
if (process.env.ONION_URL) {
|
if (process.env.ONION_URL) {
|
||||||
router.get('/*', (req, res, next) => {
|
router.get('/*', (req, res, next) => {
|
||||||
res.header('Onion-Location', process.env.ONION_URL);
|
res.header('Onion-Location', process.env.ONION_URL);
|
||||||
|
@ -44,27 +43,23 @@ if (process.env.ONION_URL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
res.render('index')
|
res.render('index');
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/getting-started', (req, res) => {
|
router.get('/getting-started', (req, res) => {
|
||||||
const env = {};
|
let rawContent = fs.readFileSync(`./content/getting-started.md`, "utf8");
|
||||||
let data = fs.readFileSync(`./content/getting-started.md`, "utf8");
|
const content = md.render(rawContent);
|
||||||
|
|
||||||
let content = md.render(data, env);
|
|
||||||
res.render(`basic`, { title: `Getting started - Keyoxide`, content: content });
|
res.render(`basic`, { title: `Getting started - Keyoxide`, content: content });
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/faq', (req, res) => {
|
router.get('/faq', (req, res) => {
|
||||||
const mdFAQ = require('markdown-it')({typographer: true});
|
const mdAlt = require('markdown-it')({typographer: true});
|
||||||
mdFAQ.use(require("markdown-it-anchor"), { "level": 2, "permalink": true, "permalinkClass": 'header-anchor', "permalinkSymbol": '¶', "permalinkBefore": false });
|
mdAlt.use(require("markdown-it-anchor"), { "level": 2, "permalink": true, "permalinkClass": 'header-anchor', "permalinkSymbol": '¶', "permalinkBefore": false });
|
||||||
mdFAQ.use(require("markdown-it-table-of-contents"), { "includeLevel": [2], "listType": "ul" });
|
mdAlt.use(require("markdown-it-table-of-contents"), { "includeLevel": [2], "listType": "ul" });
|
||||||
|
|
||||||
const env = {};
|
let rawContent = fs.readFileSync(`./content/faq.md`, "utf8");
|
||||||
let data = fs.readFileSync(`./content/faq.md`, "utf8");
|
rawContent = rawContent.replace('${domain}', req.app.get('domain'));
|
||||||
data = data.replace('${domain}', req.app.get('domain'));
|
const content = mdAlt.render(rawContent);
|
||||||
|
|
||||||
let content = mdFAQ.render(data, env);
|
|
||||||
res.render(`basic`, { title: `Frequently Asked Questions - Keyoxide`, content: content });
|
res.render(`basic`, { title: `Frequently Asked Questions - Keyoxide`, content: content });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -73,13 +68,11 @@ router.get('/guides', (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/guides/:guideId', (req, res) => {
|
router.get('/guides/:guideId', (req, res) => {
|
||||||
const env = {};
|
let rawContent = fs.readFileSync(`./content/guides/${req.params.guideId}.md`, "utf8", (err, data) => {
|
||||||
let data = fs.readFileSync(`./content/guides/${req.params.guideId}.md`, "utf8", (err, data) => {
|
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
const content = md.render(rawContent);
|
||||||
let content = md.render(data, env);
|
|
||||||
res.render(`basic`, { title: `${env.title} - Keyoxide`, content: content });
|
res.render(`basic`, { title: `${env.title} - Keyoxide`, content: content });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue