-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automatic blog index pages Add block index pages and archives pages
- Loading branch information
Showing
47 changed files
with
606 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @template T | ||
* @typedef {import('@siteup/cli').PageFunction<T>} PageFunction | ||
*/ | ||
|
||
export const vars = { | ||
title: '2023 Blog Posts', | ||
layout: 'blog-auto-index' | ||
} | ||
|
||
/** | ||
* @type {PageFunction<{ | ||
* title: string | ||
* publishDate: string | ||
* }>} | ||
*/ | ||
export default async function blogIndex2023 () { | ||
return '' | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { html } from 'uland-isomorphic' | ||
import { dirname, basename } from 'node:path' | ||
|
||
/** | ||
* @template T | ||
* @typedef {import('@siteup/cli').PageFunction<T>} PageFunction | ||
*/ | ||
|
||
export const vars = { | ||
title: 'Recent Blog Posts', | ||
layout: 'blog-index' | ||
} | ||
|
||
/** | ||
* @type {PageFunction<{ | ||
* siteName: string, | ||
* siteDescription: string, | ||
* siteUrl: string, | ||
* authorName: string, | ||
* authorUrl: string, | ||
* authorImgUrl: string | ||
* layout: string, | ||
* publishDate: string | ||
* title: string | ||
* }>} | ||
*/ | ||
export default async function blogIndex2023 ({ | ||
pages, | ||
page | ||
}) { | ||
const blogPosts = pages | ||
.filter(page => page.vars.layout === 'article') | ||
// @ts-ignore | ||
.sort((a, b) => new Date(b.vars.publishDate) - new Date(a.vars.publishDate)) | ||
.slice(0, 50) | ||
|
||
const folderPages = pages.filter(folderPage => { | ||
const dir = dirname(folderPage.pageInfo.path) | ||
const path = page.path | ||
return dir === path | ||
}) | ||
|
||
return html` | ||
<ul class="blog-index-list"> | ||
${blogPosts.map(p => { | ||
const publishDate = p.vars.publishDate ? new Date(p.vars.publishDate) : null | ||
return html` | ||
<li class="blog-entry h-entry"> | ||
<a class="blog-entry-link u-url u-uid p-name" href="/${p.pageInfo.path}/">${p.vars.title}</a> | ||
${ | ||
publishDate | ||
? html`<time class="blog-entry-date dt-published" datetime="${publishDate.toISOString()}"> | ||
${publishDate.toISOString().split('T')[0]} | ||
</time>` | ||
: null | ||
} | ||
</li>` | ||
})} | ||
</ul> | ||
<footer class="blog-index-footer"> | ||
<h4>Archive</h4> | ||
<ul class="archive-list"> | ||
${folderPages.map(p => { | ||
return html`<li> | ||
<a href="/${p.pageInfo.path}/">${basename(p.pageInfo.path)}</a> | ||
</li>` | ||
})} | ||
<ul> | ||
</footer> | ||
` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.blog-index-footer { | ||
& .archive-list { | ||
display: inline-flex; | ||
gap: 1em; | ||
list-style-type: none; | ||
padding-left: 0px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.blog-index-list { | ||
padding-left: 0px; | ||
|
||
& .blog-entry { | ||
width: 100%; | ||
display: inline-flex; | ||
justify-content: space-between; | ||
} | ||
& .blog-entry-link {} | ||
& .blog-entry-date { | ||
color: var(--accent-foreground); | ||
font-family: var(--font-code); | ||
flex-shrink: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.breadcrumb-nav { | ||
margin-top: 1em; | ||
|
||
& .list { | ||
list-style-type: none; /* Removes default bullet points */ | ||
padding: 0; | ||
margin: 0; | ||
display: flex; | ||
flex-wrap: nowrap; /* Prevents wrapping items to next line */ | ||
} | ||
|
||
& .item {} | ||
|
||
& .item + .item::before { | ||
content: "/"; /* Adds a slash before each item except the first */ | ||
margin: 0 8px; /* Adjusts spacing around the slash */ | ||
color: var(--accent-midground); /* Adjusts the color of the slash */ | ||
} | ||
|
||
& .item.active { | ||
font-weight: bold; /* Highlights the active/current page */ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { html } from 'uland-isomorphic' | ||
import cn from 'classnames' | ||
|
||
export const breadcrumb = ({ | ||
pathSegments | ||
}) => { | ||
return html` | ||
<nav class="breadcrumb-nav" aria-label="breadcrumb"> | ||
<ol class="list"> | ||
${pathSegments.map((segment, i, segments) => | ||
html` | ||
<li class="${cn({ item: true, active: segments.length - 1 === i })}"> | ||
<a href="${generateRelativePathSegment(segment, i, segments.length)}">${segment}</a> | ||
</li>` | ||
)} | ||
</ol> | ||
</nav> | ||
` | ||
} | ||
|
||
const relativePathSegment = '../' | ||
function generateRelativePathSegment (segment, index, segmentLength) { | ||
const segmentCount = segmentLength - index | ||
if (index === segmentLength - 1) return './' | ||
const segments = [] | ||
for (let i = 0; i < segmentCount; i++) { | ||
segments.push(relativePathSegment) | ||
} | ||
segments.push(segment) | ||
return segments.join('') | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<link rel="icon" type="image/x-icon" href="/favicons/favicon.ico"> | ||
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png"> | ||
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png"> | ||
<link rel="icon" type="image/png" sizes="48x48" href="/favicons/favicon-48x48.png"> | ||
<link rel="apple-touch-icon" sizes="57x57" href="/favicons/apple-touch-icon-57x57.png"> | ||
<link rel="apple-touch-icon" sizes="60x60" href="/favicons/apple-touch-icon-60x60.png"> | ||
<link rel="apple-touch-icon" sizes="72x72" href="/favicons/apple-touch-icon-72x72.png"> | ||
<link rel="apple-touch-icon" sizes="76x76" href="/favicons/apple-touch-icon-76x76.png"> | ||
<link rel="apple-touch-icon" sizes="114x114" href="/favicons/apple-touch-icon-114x114.png"> | ||
<link rel="apple-touch-icon" sizes="120x120" href="/favicons/apple-touch-icon-120x120.png"> | ||
<link rel="apple-touch-icon" sizes="144x144" href="/favicons/apple-touch-icon-144x144.png"> | ||
<link rel="apple-touch-icon" sizes="152x152" href="/favicons/apple-touch-icon-152x152.png"> | ||
<link rel="apple-touch-icon" sizes="167x167" href="/favicons/apple-touch-icon-167x167.png"> | ||
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon-180x180.png"> | ||
<link rel="apple-touch-icon" sizes="1024x1024" href="/favicons/apple-touch-icon-1024x1024.png"> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> | ||
<meta name="apple-mobile-web-app-title" content="HifiWi.fi"> |
Oops, something went wrong.