Skip to content

Commit 4dd12fb

Browse files
committed
migrate posts into news section
1 parent 7e5b135 commit 4dd12fb

36 files changed

+276
-69
lines changed

.vitepress/config.mts

+64-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { defineConfig } from 'vitepress'
1+
import path from 'path'
2+
import { writeFileSync } from 'fs'
3+
import { Feed } from 'feed'
4+
import { defineConfig, createContentLoader, type SiteConfig } from 'vitepress'
5+
6+
const hostname: string = 'https://www.naemon.io'
27

38

49
// https://vitepress.dev/reference/site-config
@@ -24,6 +29,9 @@ export default defineConfig({
2429
}
2530
},
2631

32+
// https://vitepress.dev/guide/routing#generating-clean-url
33+
cleanUrls: true,
34+
2735
themeConfig: {
2836

2937
logo: '/images/svg/naemonlogo.svg',
@@ -42,6 +50,7 @@ export default defineConfig({
4250
{ text: 'FAQ', link: '/documentation/faq' },
4351
]
4452
},
53+
{ text: 'News', link: '/news' },
4554
{ text: 'Get involved', link: '/community' },
4655
],
4756

@@ -51,7 +60,7 @@ export default defineConfig({
5160

5261
sidebar: [
5362
{
54-
text: 'Examples',
63+
text: 'Download',
5564
items: [
5665
{ text: 'Download', link: '/download' },
5766
]
@@ -155,5 +164,58 @@ export default defineConfig({
155164
editLink: {
156165
pattern: 'https://github.com/naemon/naemon.github.io/edit/main/:path'
157166
}
167+
},
168+
169+
// rewrite urls from existing news
170+
// https://vitepress.dev/reference/site-config#routing
171+
rewrites: {
172+
'news/:year(\\d+)-:mon(\\d+)-:day(\\d+)-:slug(.*\\.md)': 'project/:year/:mon/:day/:slug'
173+
},
174+
175+
// write news feed from news folder
176+
buildEnd: async (config: SiteConfig) => {
177+
const feed = new Feed({
178+
title: 'Naemon',
179+
description: 'Naemon news blog',
180+
id: hostname,
181+
link: hostname,
182+
language: 'en',
183+
image: `${hostname}/public/images/logo/logo_small.png`,
184+
favicon: `${hostname}/public/favicon.ico`,
185+
copyright:
186+
'Copyright (c) 2025-present, Naemon Team'
187+
})
188+
189+
const posts = await createContentLoader('news/*.md', {
190+
excerpt: true,
191+
render: true
192+
}).load()
193+
194+
posts.sort(
195+
(a, b) =>
196+
+new Date(b.frontmatter.date as string) -
197+
+new Date(a.frontmatter.date as string)
198+
)
199+
200+
for (const { url, excerpt, frontmatter, html } of posts) {
201+
feed.addItem({
202+
title: frontmatter.title,
203+
id: `${hostname}${url}`,
204+
link: `${hostname}${url}`,
205+
description: excerpt,
206+
content: html,
207+
author: [
208+
{
209+
name: 'Naemon Team',
210+
211+
link: hostname
212+
}
213+
],
214+
date: frontmatter.date
215+
})
216+
}
217+
218+
writeFileSync(path.join(config.outDir, 'news/feed'), feed.rss2())
219+
writeFileSync(path.join(config.outDir, 'news/feed.rss'), feed.rss2())
158220
}
159221
})

.vitepress/theme/News.vue

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<script setup>
2+
import { useData } from 'vitepress'
3+
const { page, frontmatter } = useData()
4+
5+
const formatDate = function(raw) {
6+
const date = new Date(raw)
7+
date.setUTCHours(12)
8+
return {
9+
time: +date,
10+
string: date.toLocaleDateString('en-US', {
11+
year: 'numeric',
12+
month: 'short',
13+
day: 'numeric'
14+
})
15+
}
16+
}
17+
18+
const date = formatDate(frontmatter.value.date)
19+
20+
</script>
21+
22+
<style scoped>
23+
24+
div.news {
25+
margin: 20px 0;
26+
text-align: right;
27+
}
28+
29+
div.main {
30+
max-width: 800px;
31+
margin: auto;
32+
}
33+
34+
h3 {
35+
width: fit-content;
36+
}
37+
38+
</style>
39+
40+
<template>
41+
42+
<div class="main vp-doc">
43+
<div class="news"><a href="/news/feed.rss"><i class="fas fa-rss"></i> News Feed</a></div>
44+
45+
<div style="display: flex; flex-direction: row; justify-content: space-between;">
46+
<h3>{{ frontmatter.title }}</h3>
47+
<h3>{{ date.string }}</h3>
48+
</div>
49+
<hr>
50+
<Content />
51+
</div>
52+
53+
</template>

.vitepress/theme/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { Theme } from 'vitepress'
33
import DefaultTheme from 'vitepress/theme'
44
import '@fortawesome/fontawesome-free/css/all.css'
55
import './naemon.css'
6+
import News from './News.vue'
67

78
export default {
89
extends: DefaultTheme,
@@ -12,5 +13,7 @@ export default {
1213
// VITE_RELEASE_VERSION will become available as $RELEASE_VERSION in the Markdown files
1314
app.config.globalProperties.$RELEASE_VERSION = import.meta.env.VITE_RELEASE_VERSION
1415
app.config.globalProperties.$RELEASE_DATE = import.meta.env.VITE_RELEASE_DATE
16+
17+
app.component('news', News)
1518
}
1619
} satisfies Theme

legacy/core.md

-5
This file was deleted.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"private": true,
44
"version": "0.0.0",
55
"devDependencies": {
6-
"vitepress": "^1.5.0"
6+
"vitepress": "^1.5.0",
7+
"feed": "^4.2.2"
78
},
89
"scripts": {
910
"docs:dev": "npx vitepress dev --host",

legacy/_posts/2014-02-01-quality-work.md src/news/2014-02-01-quality-work.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Quality work"
4-
categories: core
3+
date: 2014-02-01
4+
sidebar: false
5+
layout: news
56
---
67

78
One of our frustrations with Nagios is that while it does have a lot of tests, very few of them actually pass. That's OK, though, because they're executed very rarely.

legacy/_posts/2014-02-01-release.md src/news/2014-02-01-release.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "All quiet on the release front"
4-
categories: project
3+
date: 2014-02-01
4+
sidebar: false
5+
layout: news
56
---
67

78
We're still working on getting a release out - unfortunately, we've been having some issues with our build system.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "documentation project started"
4-
categories: project
3+
date: 2014-02-09
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we started the documentation project and you are welcome to help out.
@@ -10,4 +11,4 @@ has to be written by single person.
1011

1112
The issues with our build system have been sorted out and it seems quite stable
1213
and we only have to tweak some last things, like better init scripts, before
13-
we finally release the first version of Naemon.
14+
we finally release the first version of Naemon.

legacy/_posts/2014-02-14-release-day.md src/news/2014-02-14-release-day.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 0.8.0"
4-
categories: project
3+
date: 2014-02-14
4+
sidebar: false
5+
layout: news
56
---
67

78
Almost half a year after we started this project we can now announce the first release.

legacy/_posts/2014-03-22-docs.md src/news/2014-03-22-docs.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: Progress on documentation project
4-
categories: project
3+
date: 2014-03-22
4+
sidebar: false
5+
layout: news
56
---
67

78
Since we started the documentation project, we made great progress. Mostly due to
@@ -27,4 +28,4 @@ Next steps are:
2728

2829
- finish review
2930
- complete missing pages
30-
- include documentation in source tarball
31+
- include documentation in source tarball

legacy/_posts/2014-08-27-on-the-road.md src/news/2014-08-27-on-the-road.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: On the road to 1.0
4-
categories: project
3+
date: 2014-08-27
4+
sidebar: false
5+
layout: news
56
---
67

78
Summer vacation is over and we are making good progress on the way to a stable

legacy/_posts/2015-03-30-release-day.md src/news/2015-03-30-release-day.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.0.3"
4-
categories: project
3+
date: 2015-03-30
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released our first bug fix release after the 1.0 in February.

legacy/_posts/2016-06-03-release-1.0.4.md src/news/2016-06-03-release-1.0.4.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.0.4"
4-
categories: project
3+
date: 2016-06-03
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.0.4 of naemon-core and naemon-livestatus. Thanks to all

legacy/_posts/2016-06-21-release-1.0.5.md src/news/2016-06-21-release-1.0.5.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.0.5"
4-
categories: project
3+
date: 2016-06-21
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.0.5 of naemon-core and naemon-livestatus. Thanks to all

legacy/_posts/2017-01-23-release-1.0.6.md src/news/2017-01-23-release-1.0.6.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.0.6"
4-
categories: project
3+
date: 2017-01-23
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.0.6 of naemon-core and naemon-livestatus. Thanks to all

legacy/_posts/2017-11-01-vulnerabilities.md src/news/2017-11-01-vulnerabilities.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "CVE-2016-9565 and CVE-2016-9566"
4-
categories: project
3+
date: 2017-11-01
4+
sidebar: false
5+
layout: news
56
---
67

78
A few few weeks ago two CVEs have been announced for the Nagios core and Nagios webinterface. Since Naemon inherits some code

legacy/_posts/2018-06-01-release-1.0.7.md src/news/2018-06-01-release-1.0.7.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.0.7"
4-
categories: project
3+
date: 2018-06-01
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.0.7 of naemon-core and naemon-livestatus. Thanks to all

legacy/_posts/2018-07-16-release-1.0.8.md src/news/2018-07-16-release-1.0.8.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.0.8"
4-
categories: project
3+
date: 2018-07-16
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.0.8 of naemon-core and naemon-livestatus. Thanks to all

legacy/_posts/2018-08-13-cve.md src/news/2018-08-13-cve.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "CVEs"
4-
categories: project
3+
date: 2018-08-13
4+
sidebar: false
5+
layout: news
56
---
67

78
You might have read about the recent discovery of some security issues in nagios 4 and might be wondering if naemon is affected to.

legacy/_posts/2018-12-18-release-1.0.9.md src/news/2018-12-18-release-1.0.9.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.0.9"
4-
categories: project
3+
date: 2018-12-18
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.0.9 of naemon-core and naemon-livestatus. Thanks to all

legacy/_posts/2019-03-19-release-1.0.10.md src/news/2019-03-19-release-1.0.10.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.0.10"
4-
categories: project
3+
date: 2019-03-19
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.0.10 of naemon-core and naemon-livestatus. Thanks to all

legacy/_posts/2019-09-05-release-1.1.0.md src/news/2019-09-05-release-1.1.0.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.1.0"
4-
categories: project
3+
date: 2019-09-05
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.1.0 of naemon-core and naemon-livestatus. Thanks to all

legacy/_posts/2020-02-17-release-1.2.0.md src/news/2020-02-17-release-1.2.0.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
layout: post
32
title: "Release 1.2.0"
4-
categories: project
3+
date: 2020-02-17
4+
sidebar: false
5+
layout: news
56
---
67

78
Today we released the version 1.2.0 of naemon-core and naemon-livestatus. Thanks to all

0 commit comments

Comments
 (0)