File tree Expand file tree Collapse file tree 5 files changed +72
-14
lines changed Expand file tree Collapse file tree 5 files changed +72
-14
lines changed Original file line number Diff line number Diff line change 11title = "HELLO WORLD"
2- date = "2025-10-30T15:20:11.486765Z "
2+ date = "2025-10-30T12:00:00Z "
33template = "blog"
4- tags = [ ]
54
65[ extra]
76author = "Michelle Dhanani"
Original file line number Diff line number Diff line change 1- title = "blog"
2- template = "blog"
3- date = "2025-10-29T00:22:56Z"
4- content_type = "application/json"
1+ title = "Spin | Community Blog"
2+ template = "main"
3+ date = "2022-04-01T00:00:00Z"
4+
5+ [ extra]
6+ author = "Spin Community"
7+ type = "index"
8+ category = "index"
59
610---
Original file line number Diff line number Diff line change 1+ // This function lists all of the blog posts, subject to the constraints.
2+ //
3+ // It returns an array of objects of the form:
4+ // [
5+ // #{
6+ // uri: "path/to/page",
7+ // page: {
8+ // head: {title: "some title", description: "Some description", ...}
9+ // body: "This is the HTML"
10+ // }
11+ // }
12+ // ]
13+ //
14+ // The array is sorted with the earlier items being most recent, and the oldest items at the end.
15+
16+ // Param 1 should be `site.pages`
17+ let pages = params[0];
18+
19+ // Loop through them and return all of the page objects that are in
20+ // the blog path.
21+
22+ let blog_pages = [];
23+
24+ // Get each blog post, assigning it to {path: object}.
25+ let keys = pages.keys();
26+ for item in keys {
27+ if item.index_of("/content/blog/") == 0 && pages[item].head.extra.type == "post" {
28+ // Remove /content and .md
29+ let path = item.sub_string(8);
30+ let page = pages[item];
31+ path = path.sub_string(0, path.index_of(".md"));
32+
33+ blog_pages.push(#{
34+ uri: path,
35+ page: page,
36+ template: "blog",
37+ });
38+ //blog_pages[path] = pages[item];
39+ }
40+
41+ }
42+
43+ // Return the blogs sorted newest to oldest
44+ fn sort_by_date(a, b) {
45+ if a.page.head.date < b.page.head.date {
46+ 1
47+ } else {
48+ -1
49+ }
50+ }
51+
52+ // Sort by the value of the page date.
53+ blog_pages.sort(Fn("sort_by_date"));
54+
55+ blog_pages
Original file line number Diff line number Diff line change 1616 <div class =" navbar-menu" >
1717 <div class =" navbar-start" >
1818
19- <a class =" navbar-item plausible-event-name=docs-nav navbar-stack" href =" /blog" title =" Spin community blog" >
20- <strong >Community Blog</strong >
21- <small >Stay up to date on latest with Spin</small >
22-
19+ <a class =" navbar-item plausible-event-name=docs-nav navbar-stack" href =" /docs" title =" Spin Documentation" >
20+ <strong >Docs</strong >
21+ <small >Get started building Wasm apps with Spin</small >
2322 </a >
2423
2524 <a class =" navbar-item plausible-event-name=docs-nav-hub navbar-stack" href =" /hub" title =" Sample apps, plugins and templates in Spin Hub" >
2625 <strong >Spin Hub</strong >
2726 <small >Browse example app code and templates</small >
2827 </a >
2928
29+ <a class =" navbar-item plausible-event-name=docs-nav navbar-stack" href =" /blog/index" title =" Spin Community Blog" >
30+ <strong >Community Blog</strong >
31+ <small >Stay up to date on Spin releases</small >
32+ </a >
33+
3034 {{!-- <a class="navbar-item plausible-event-name=docs-nav-blog navbar-stack" href="/blog" title="Sample apps, plugins and templates in Spin Hub">
3135 <strong>Blog</strong>
3236 <small>Latest community posts about Spin</small>
Original file line number Diff line number Diff line change 4646
4747{{! This closes the body. See content_bottom.hbs. }}
4848{{> content_bottom }}
49-
50- </body >
51-
52- </html >
You can’t perform that action at this time.
0 commit comments