v0.1.7: Fix blog navbar consistency with Git Repository link
This commit is contained in:
@@ -5,6 +5,9 @@ const matter = require('gray-matter');
|
||||
const postsDir = path.join(__dirname, '_posts');
|
||||
const outputDir = path.join(__dirname, 'blog');
|
||||
|
||||
const GIT_URL = process.env.GIT_URL || 'https://git.kropa.tech/lotherk/deardiary';
|
||||
const APP_URL = process.env.APP_URL || 'https://deardiary.hiddenbox.org';
|
||||
|
||||
// Ensure output directory exists
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
@@ -63,7 +66,7 @@ const posts = files.map(file => {
|
||||
// Sort posts by date (newest first)
|
||||
posts.sort((a, b) => new Date(b.date) - new Date(a.date));
|
||||
|
||||
const relativePath = process.env.GIT_URL ? '' : '../';
|
||||
const relativePath = '../';
|
||||
|
||||
// Generate index page
|
||||
const indexHtml = `<!DOCTYPE html>
|
||||
@@ -98,8 +101,8 @@ const indexHtml = `<!DOCTYPE html>
|
||||
<div class="nav-links">
|
||||
<a href="${relativePath}index.html">Home</a>
|
||||
<a href="${relativePath}docs/">Docs</a>
|
||||
<a href="${relativePath}blog/">Blog</a>
|
||||
<a href="${relativePath}index.html" class="btn btn-primary">Join Free Alpha</a>
|
||||
<a href="${relativePath}blog/" class="active">Blog</a>
|
||||
<a href="${GIT_URL}" target="_blank">Git Repository</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -132,7 +135,7 @@ posts.forEach(post => {
|
||||
fs.mkdirSync(postDir, { recursive: true });
|
||||
}
|
||||
|
||||
const postRelativePath = process.env.GIT_URL ? '' : '../../';
|
||||
const postRelativePath = '../../';
|
||||
|
||||
const postHtml = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -171,8 +174,8 @@ posts.forEach(post => {
|
||||
<div class="nav-links">
|
||||
<a href="${postRelativePath}index.html">Home</a>
|
||||
<a href="${postRelativePath}docs/">Docs</a>
|
||||
<a href="${postRelativePath}blog/">Blog</a>
|
||||
<a href="${postRelativePath}index.html" class="btn btn-primary">Join Free Alpha</a>
|
||||
<a href="${postRelativePath}blog/" class="active">Blog</a>
|
||||
<a href="${GIT_URL}" target="_blank">Git Repository</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
Reference in New Issue
Block a user