Skip to content

Commit e0bd5b6

Browse files
committed
Merge #146: Refactor blog section to use SvelteKit instead of Markdown
004b6f8 Fix linting error (Graeme Byrne) 933d86c Refactor blog section to use SvelteKit instead of Markdown (Graeme Byrne) Pull request description: ## Refactor Blog Section: Transition from Markdown to SvelteKit-based Posts - **Old structure**: Previously, each blog post was represented as a Markdown file inside the `/blog` directory. The content was accessed via dynamic routes like `blog/[slug]`. - **New structure**: Now, each blog post is stored in its own directory under `src/routes/blog/{post-slug}`, where `{post-slug}` is the specific slug for each blog post (e.g., `src/routes/blog/benchmarking-the-torrust-bittorrent-tracker`). Each post has a `+page.svelte` file that handles the display logic for that specific post. - **Metadata handling**: - Introduced a `metadata.ts` file in each blog post directory to store post-specific data such as title, excerpt, tags, contributor, and cover image. - A global `metadata.ts` file in the `lib/data` directory fetches all the blog post metadata from `static/blogMetadata.json`, which is generated by a custom script (`scripts/generateMetadata.ts`). - The metadata is read and parsed to fetch details such as the post title, contributor, and tags, then made available for rendering in the `+page.svelte` component for each post. - **`generateMetadata.ts` script**: Added a new script that reads all `metadata.ts` files from the `src/routes/blog` directory, collects metadata for each blog post, and generates a `static/blogMetadata.json` file to serve as a centralized metadata source. - **Benefits**: - Improved scalability and maintainability by transitioning from Markdown to SvelteKit-native routes and metadata. - Simplified data flow and fetching for blog posts, as metadata is now dynamically loaded and cached. - Enhanced flexibility in post structuring and content management, supporting richer features beyond the Markdown-based setup. ACKs for top commit: josecelano: ACK 004b6f8 Tree-SHA512: 5441b01cff43dcecae4c518c82f1ce13e53333fc50d074104cc67d853be80372d34fe95bce61de6bb751472c88561f5d2661f2cc084e48cba36f20436ef50d56
2 parents 665956e + 004b6f8 commit e0bd5b6

File tree

112 files changed

+11627
-6057
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+11627
-6057
lines changed

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ package-lock.json
1515
pnpm-lock.yaml
1616
yarn.lock
1717

18-
src/routes/blog/**/*.md
18+
src/routes/blog/**/*.md
19+
static/blogMetadata.json

eslint.config.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default [
3232
'package-lock.json'
3333
],
3434
rules: {
35+
'@typescript-eslint/require-await': 'off',
3536
'prettier/prettier': 'error',
3637
'no-sparse-arrays': 'off',
3738
'no-undef': 'off',
@@ -41,7 +42,6 @@ export default [
4142
'no-unused-vars': 'off',
4243
'no-constant-condition': 'off',
4344
'no-cond-assign': 'off',
44-
'@typescript-eslint/require-await': 'off',
4545
'no-control-regex': 'off',
4646
'no-case-declarations': 'off',
4747
'no-self-assign': 'off',
@@ -51,7 +51,8 @@ export default [
5151
'no-redeclare': 'off',
5252
'no-extra-boolean-cast': 'off',
5353
'no-misleading-character-class': 'off',
54-
'no-unused-disable': 'off'
54+
'no-unused-disable': 'off',
55+
'no-unused-disable-directive': 'off'
5556
},
5657
plugins: {
5758
prettier: eslintPluginPrettier,
@@ -75,8 +76,9 @@ export default [
7576
'no-unused-vars': 'off',
7677
'no-control-regex': 'off',
7778
'no-fallthrough': 'off',
78-
'@typescript-eslint/require-await': 'off',
79-
'no-unused-labels': 'off'
79+
'no-unused-labels': 'off',
80+
'no-warning-comments': 'off',
81+
'no-unused-disable-directive': 'off'
8082
}
8183
},
8284

0 commit comments

Comments
 (0)