v0.1.7: Fix blog navbar consistency with Git Repository link

This commit is contained in:
lotherk
2026-03-27 15:14:49 +00:00
parent a5f1f89176
commit eb016863c2
4 changed files with 15 additions and 7 deletions

View File

@@ -233,6 +233,7 @@ Version is managed via `VERSION.txt` (single source of truth). All other version
- Never commit actual version numbers in source files - Never commit actual version numbers in source files
## Version History ## Version History
- 0.1.7: Fix blog navbar consistency with Git Repository link
- 0.1.6: Add comprehensive API docs and additional documentation pages - 0.1.6: Add comprehensive API docs and additional documentation pages
- 0.1.5: Fix ENV syntax in website Dockerfile - 0.1.5: Fix ENV syntax in website Dockerfile
- 0.1.4: Version links to git releases on website - 0.1.4: Version links to git releases on website

View File

@@ -2,12 +2,16 @@ FROM alpine:latest AS version
COPY VERSION.txt /tmp/version.txt COPY VERSION.txt /tmp/version.txt
FROM node:20-alpine AS builder FROM node:20-alpine AS builder
ARG GIT_URL=https://git.kropa.tech/lotherk/deardiary
ARG APP_URL=https://deardiary.hiddenbox.org
WORKDIR /app/www WORKDIR /app/www
COPY www/package.json www/package-lock.json ./ COPY www/package.json www/package-lock.json ./
RUN npm install RUN npm install
COPY www/ ./ COPY www/ ./
ENV GIT_URL=$GIT_URL
ENV APP_URL=$APP_URL
RUN node build-blog.js RUN node build-blog.js
FROM nginx:alpine FROM nginx:alpine

View File

@@ -1 +1 @@
0.1.6 0.1.7

View File

@@ -5,6 +5,9 @@ const matter = require('gray-matter');
const postsDir = path.join(__dirname, '_posts'); const postsDir = path.join(__dirname, '_posts');
const outputDir = path.join(__dirname, 'blog'); 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 // Ensure output directory exists
if (!fs.existsSync(outputDir)) { if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true }); fs.mkdirSync(outputDir, { recursive: true });
@@ -63,7 +66,7 @@ const posts = files.map(file => {
// Sort posts by date (newest first) // Sort posts by date (newest first)
posts.sort((a, b) => new Date(b.date) - new Date(a.date)); posts.sort((a, b) => new Date(b.date) - new Date(a.date));
const relativePath = process.env.GIT_URL ? '' : '../'; const relativePath = '../';
// Generate index page // Generate index page
const indexHtml = `<!DOCTYPE html> const indexHtml = `<!DOCTYPE html>
@@ -98,8 +101,8 @@ const indexHtml = `<!DOCTYPE html>
<div class="nav-links"> <div class="nav-links">
<a href="${relativePath}index.html">Home</a> <a href="${relativePath}index.html">Home</a>
<a href="${relativePath}docs/">Docs</a> <a href="${relativePath}docs/">Docs</a>
<a href="${relativePath}blog/">Blog</a> <a href="${relativePath}blog/" class="active">Blog</a>
<a href="${relativePath}index.html" class="btn btn-primary">Join Free Alpha</a> <a href="${GIT_URL}" target="_blank">Git Repository</a>
</div> </div>
</div> </div>
</nav> </nav>
@@ -132,7 +135,7 @@ posts.forEach(post => {
fs.mkdirSync(postDir, { recursive: true }); fs.mkdirSync(postDir, { recursive: true });
} }
const postRelativePath = process.env.GIT_URL ? '' : '../../'; const postRelativePath = '../../';
const postHtml = `<!DOCTYPE html> const postHtml = `<!DOCTYPE html>
<html lang="en"> <html lang="en">
@@ -171,8 +174,8 @@ posts.forEach(post => {
<div class="nav-links"> <div class="nav-links">
<a href="${postRelativePath}index.html">Home</a> <a href="${postRelativePath}index.html">Home</a>
<a href="${postRelativePath}docs/">Docs</a> <a href="${postRelativePath}docs/">Docs</a>
<a href="${postRelativePath}blog/">Blog</a> <a href="${postRelativePath}blog/" class="active">Blog</a>
<a href="${postRelativePath}index.html" class="btn btn-primary">Join Free Alpha</a> <a href="${GIT_URL}" target="_blank">Git Repository</a>
</div> </div>
</div> </div>
</nav> </nav>