Commit e0bd5b6
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: 5441b01cff43dcecae4c518c82f1ce13e53333fc50d074104cc67d853be80372d34fe95bce61de6bb751472c88561f5d2661f2cc084e48cba36f20436ef50d56File tree
112 files changed
+11627
-6057
lines changed- scripts
- src
- lib
- components
- atoms
- molecules
- organisms
- singletons
- data
- utils
- routes
- (home)
- (pages)
- about
- community
- self-host
- api
- blog
- [slug]
- benchmarking-the-torrust-bittorrent-tracker
- bencode-to-json-converter-in-rust
- containerizing-rust-applications-best-practices
- contributor-path
- deploying-torrust-to-production
- hash2torrent-retrieve-torrent-files-effortlessly
- help-shape-the-torrust-2025-roadmap
- how-to-contribute-to-this-site
- how-to-run-a-local-demo
- how-to-setup-the-development-environment
- introducing-the-new-sample-torrent-migration-tool
- live-demo-beta-v3
- profiling-the-torrust-bittorrent-udp-tracker
- released-v3-0-0-beta
- released-v3-0-0
- review-and-setup-guide-for-unit3d
- the-enigmatic-torrent-source-field
- torrust-enhancing-the-bittorrent-ecosystem
- visualize-tracker-metrics-prometheus-grafana
- what-is-a-bittorent-tracker
- contributor
- tags/[tagId]
- static
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| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | | - | |
79 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
0 commit comments