Remove prefix from URLs
This commit is contained in:
parent
39766e069e
commit
334534980a
3 changed files with 3 additions and 21 deletions
|
@ -1,17 +0,0 @@
|
||||||
import element from 'https://cdn.jsdelivr.net/gh/darkwiiplayer/js@3724b3e/element.js'
|
|
||||||
import {html, empty} from 'https://cdn.jsdelivr.net/gh/darkwiiplayer/js@cdaeac1/skooma.js'
|
|
||||||
|
|
||||||
export default element(class BlogPost extends HTMLElement {
|
|
||||||
static attributes = { name: true }
|
|
||||||
constructor() {
|
|
||||||
super()
|
|
||||||
this.post = posts.find(post => post.head.slug == this.name)
|
|
||||||
}
|
|
||||||
async nameChanged() {
|
|
||||||
this.replace(
|
|
||||||
html.a({href: `/blog${this.post.head.uri}`}, html.h2(this.post.head.title)),
|
|
||||||
this.post.head.description ? html.p(this.post.head.description) : undefined,
|
|
||||||
html.p(html.time$localDate({datetime: this.post.head.date, class: ["timestamp"]}))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -1,16 +1,15 @@
|
||||||
import output from require 'params'
|
|
||||||
slots, json = select 1, ...
|
slots, json = select 1, ...
|
||||||
posts = require 'posts'
|
posts = require 'posts'
|
||||||
|
|
||||||
post = =>
|
post = =>
|
||||||
a href: "/"..output..@head.uri,
|
a href: @head.uri,
|
||||||
* flexColumn
|
* flexColumn
|
||||||
* h2 @head.title, style: "view-transition-name: #{@head.slug}"
|
* h2 @head.title, style: "view-transition-name: #{@head.slug}"
|
||||||
* time is: 'local-date', datetime: @head.date, @head.date
|
* time is: 'local-date', datetime: @head.date, @head.date
|
||||||
* @head.description
|
* @head.description
|
||||||
|
|
||||||
slots.head title "Index"
|
slots.head title "Index"
|
||||||
slots.head script type: 'module', src: "/#{output}/javascript/LocalDate.js"
|
slots.head script type: 'module', src: "/javascript/LocalDate.js"
|
||||||
|
|
||||||
return main
|
return main
|
||||||
* h1 "Blog Posts"
|
* h1 "Blog Posts"
|
||||||
|
|
|
@ -35,6 +35,6 @@ html
|
||||||
* header class: 'sticky'
|
* header class: 'sticky'
|
||||||
* h1 "Talia's Blog"
|
* h1 "Talia's Blog"
|
||||||
* nav { class: 'right bar' }
|
* nav { class: 'right bar' }
|
||||||
* ul li a "Home", href: "/blog"
|
* ul li a "Home", href: "/"
|
||||||
* main
|
* main
|
||||||
* content slots, data
|
* content slots, data
|
||||||
|
|
Loading…
Reference in a new issue