The code and data behind xeiaso.net
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: use time tag for date (#760)

* feat: use `time` tag

* refactor: use `DATE_US` filter

authored by

scarf and committed by
GitHub
a1614672 95d775d4

+15 -17
+2 -4
internal/lume/lume.go
··· 431 431 export const layout = "base.njk"; 432 432 export const date = "2012-01-01"; 433 433 434 - export default ({ search }) => { 435 - const dateOptions = { year: "numeric", month: "2-digit", day: "2-digit" }; 436 - 434 + export default ({ search }, { date }) => { 437 435 return ( 438 436 <div> 439 437 <h1 className="text-3xl mb-4">{title}</h1> ··· 446 444 const url = post.data.redirect_to ? post.data.redirect_to : post.data.url; 447 445 return ( 448 446 <li> 449 - <span className="font-mono">{post.data.date.toLocaleDateString("en-US", dateOptions)}</span> -{" "} 447 + <time datetime={date(post.data.date)} className="font-mono">{date(post.data.date, "DATE_US")}</time> -{" "} 450 448 <a href={url}>{post.data.title}</a> 451 449 </li> 452 450 );
+5 -1
lume/_config.ts
··· 44 44 45 45 site.use(jsx_preact()); 46 46 site.use(attributes()); 47 - site.use(date()); 47 + site.use(date({ 48 + formats: { 49 + "DATE_US": "MM/dd/yyyy", 50 + }, 51 + })); 48 52 site.use(esbuild({ esm: true })); 49 53 site.use(feed({ 50 54 output: ["/blog.rss", "/blog.json"],
+1 -1
lume/src/_includes/blog.njk
··· 7 7 <article class="prose dark:prose-invert max-w-none"> 8 8 <h1>{{title}}</h1> 9 9 <p class="text-sm text-fg-3 dark:text-fgDark-3 mb-2"> 10 - Published on {{date.toLocaleDateString("en-US", { year: "numeric", month: "2-digit", day: "2-digit" })}}, {{ readingInfo.words }} words, {{ readingInfo.minutes }} minutes to read 10 + Published on <time datetime={{date | date("DATE")}}>{{date | date("DATE_US")}}</time>, {{ readingInfo.words }} words, {{ readingInfo.minutes }} minutes to read 11 11 </p> 12 12 13 13 {% if hero %}
+2 -2
lume/src/blog.jsx
··· 1 1 export const title = "Blog Articles"; 2 2 export const layout = "base.njk"; 3 3 4 - export default ({ search }) => { 4 + export default ({ search }, { date }) => { 5 5 const dateOptions = { year: "numeric", month: "2-digit", day: "2-digit" }; 6 6 7 7 return ( ··· 19 19 const url = post.data.redirect_to ? post.data.redirect_to : post.data.url; 20 20 return ( 21 21 <li> 22 - <span className="font-mono">{post.data.date.toLocaleDateString("en-US", dateOptions)}</span> -{" "} 22 + <time datetime={date(post.data.date)} className="font-mono">{post.data.date.toLocaleDateString("en-US", dateOptions)}</time> -{" "} 23 23 <a href={url}>{post.data.title}</a> 24 24 </li> 25 25 );
+1 -1
lume/src/index.njk
··· 18 18 <h2 class="text-2xl mb-4">Recent Articles</h2> 19 19 <ul class="list-disc ml-4 mb-4"> 20 20 {% for post in search.pages("type=blog", "order date=desc", 5) %} 21 - <li>{{post.data.date | date("DATE")}} - <a href="{{post.data.url}}">{{post.data.title}}</a> 21 + <li><time datetime={{post.data.date | date("DATE")}}>{{post.data.date | date("DATE")}}</time> - <a href="{{post.data.url}}">{{post.data.title}}</a> 22 22 </li> 23 23 {% endfor %} 24 24 </ul>
+2 -4
lume/src/talks.jsx
··· 1 1 export const title = "Conference Talks"; 2 2 export const layout = "base.njk"; 3 3 4 - export default ({ search }) => { 5 - const dateOptions = { year: "numeric", month: "2-digit", day: "2-digit" }; 6 - 4 + export default ({ search }, { date }) => { 7 5 return ( 8 6 <> 9 7 <h1 className="text-3xl mb-4">{title}</h1> ··· 11 9 <ul class="list-disc ml-4 mb-4"> 12 10 {search.pages("layout=talk.njk", "order date=desc").map((post) => ( 13 11 <li> 14 - {post.data.date.toLocaleDateString("en-US", dateOptions)} -{" "} 12 + <time datetime={date(post.data.date)}>{date(post.data.date, "DATE_US")}</time> -{" "} 15 13 <a href={post.data.url}>{post.data.title}</a> 16 14 </li> 17 15 ))}
+2 -4
lume/src/vods.jsx
··· 1 1 export const title = "Stream VODs"; 2 2 export const layout = "base.njk"; 3 3 4 - export default ({ search }) => { 5 - const dateOptions = { year: "numeric", month: "numeric", day: "numeric" }; 6 - 4 + export default ({ search }, { date }) => { 7 5 return ( 8 6 <> 9 7 <h1 className="text-3xl mb-4">{title}</h1> ··· 30 28 <ul class="list-disc ml-4 mb-4"> 31 29 {search.pages("layout=vod.njk", "order date=desc").map((post) => ( 32 30 <li> 33 - {post.data.date.toLocaleDateString("en-US", dateOptions)} -{" "} 31 + <time datetime={date(post.data.date)}>{date(post.data.date, "DATE_US")}</time> -{" "} 34 32 <a href={post.data.url}> 35 33 {post.data.title} 36 34 </a>