diff options
| author | Volpeon <git@volpeon.ink> | 2021-11-17 17:43:40 +0100 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2021-11-17 17:43:40 +0100 |
| commit | 18321ad1c5c09534e39817d9b75070b5481950bd (patch) | |
| tree | 9a1064ac9294be0211533e58bd36fd692aff0888 | |
| parent | Undo preload removal (diff) | |
| download | volpeon.ink-18321ad1c5c09534e39817d9b75070b5481950bd.tar.gz volpeon.ink-18321ad1c5c09534e39817d9b75070b5481950bd.tar.bz2 volpeon.ink-18321ad1c5c09534e39817d9b75070b5481950bd.zip | |
Improved list, made header sticky, removed git link
| -rw-r--r-- | assets/css/components/_card-list.scss | 6 | ||||
| -rw-r--r-- | assets/css/components/_header.scss | 2 | ||||
| -rw-r--r-- | content/9thPK7O3xn/index.md | 2 | ||||
| -rw-r--r-- | content/9thPK7O3xn/posts/index.md (renamed from content/9thPK7O3xn/pages/index.md) | 2 | ||||
| -rw-r--r-- | content/index.md | 3 | ||||
| -rw-r--r-- | content/posts/index.md (renamed from content/docs/index.md) | 2 | ||||
| -rw-r--r-- | content/profiles/git.md | 6 | ||||
| -rw-r--r-- | scripts/metadata_filter.lua | 101 | ||||
| -rw-r--r-- | templates/layouts/categorized_list.html | 11 |
9 files changed, 82 insertions, 53 deletions
diff --git a/assets/css/components/_card-list.scss b/assets/css/components/_card-list.scss index 0f44b00..7455193 100644 --- a/assets/css/components/_card-list.scss +++ b/assets/css/components/_card-list.scss | |||
| @@ -23,6 +23,10 @@ | |||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | @include element('category-title') { | 25 | @include element('category-title') { |
| 26 | display: inline-block; | ||
| 27 | margin-top: 0; | ||
| 28 | margin-right: 1em; | ||
| 29 | |||
| 26 | :link, | 30 | :link, |
| 27 | :visited { | 31 | :visited { |
| 28 | text-decoration: none; | 32 | text-decoration: none; |
| @@ -33,7 +37,7 @@ | |||
| 33 | } | 37 | } |
| 34 | } | 38 | } |
| 35 | 39 | ||
| 36 | @include element('category-subtitle') { | 40 | @include element('category-description') { |
| 37 | display: block; | 41 | display: block; |
| 38 | 42 | ||
| 39 | p { | 43 | p { |
diff --git a/assets/css/components/_header.scss b/assets/css/components/_header.scss index 9afa2e6..1470bea 100644 --- a/assets/css/components/_header.scss +++ b/assets/css/components/_header.scss | |||
| @@ -72,6 +72,8 @@ | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | @include media('>=lg') { | 74 | @include media('>=lg') { |
| 75 | position: sticky; | ||
| 76 | top: 2px; | ||
| 75 | margin-bottom: calc(-.75 * #{prop(--dims --height)}); | 77 | margin-bottom: calc(-.75 * #{prop(--dims --height)}); |
| 76 | } | 78 | } |
| 77 | } | 79 | } |
diff --git a/content/9thPK7O3xn/index.md b/content/9thPK7O3xn/index.md index 58272fb..1dd3b1e 100644 --- a/content/9thPK7O3xn/index.md +++ b/content/9thPK7O3xn/index.md | |||
| @@ -5,4 +5,4 @@ feed: true | |||
| 5 | --- | 5 | --- |
| 6 | 6 | ||
| 7 | Welcome to the personal section of my website! | 7 | Welcome to the personal section of my website! |
| 8 | Here you will find content that doesn't belong in the public sections of my website such as test pages or essays about more personal topics. | 8 | Here you will find content that doesn't belong in the public sections of my website such as test pages or posts about more personal topics. |
diff --git a/content/9thPK7O3xn/pages/index.md b/content/9thPK7O3xn/posts/index.md index 4c42948..8801530 100644 --- a/content/9thPK7O3xn/pages/index.md +++ b/content/9thPK7O3xn/posts/index.md | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | --- | 1 | --- |
| 2 | title: Pages | 2 | title: Posts |
| 3 | position: 0 | 3 | position: 0 |
| 4 | list_read_indicators: true | 4 | list_read_indicators: true |
| 5 | feed: true | 5 | feed: true |
diff --git a/content/index.md b/content/index.md index 75efead..f6e7893 100644 --- a/content/index.md +++ b/content/index.md | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | --- | 1 | --- |
| 2 | title: Volpeon's Den | 2 | title: Volpeon's Den |
| 3 | list_limit: 4 | ||
| 3 | --- | 4 | --- |
| 4 | 5 | ||
| 5 | Hi, I'm Volpeon! I'm a software developer who creates vector art. | 6 | Hi, I'm Volpeon! I'm a software developer who creates vector art. |
diff --git a/content/docs/index.md b/content/posts/index.md index d02c2a8..4396e20 100644 --- a/content/docs/index.md +++ b/content/posts/index.md | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | --- | 1 | --- |
| 2 | title: Documents | 2 | title: Posts |
| 3 | position: 3 | 3 | position: 3 |
| 4 | --- | 4 | --- |
diff --git a/content/profiles/git.md b/content/profiles/git.md deleted file mode 100644 index 63b1bfc..0000000 --- a/content/profiles/git.md +++ /dev/null | |||
| @@ -1,6 +0,0 @@ | |||
| 1 | --- | ||
| 2 | title: Git | ||
| 3 | subtitle: git.vulpes.one | ||
| 4 | icon: git-branch | ||
| 5 | url: https://git.vulpes.one/ | ||
| 6 | --- | ||
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 5a547ee..5fa7dfc 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua | |||
| @@ -9,6 +9,16 @@ function pandoc.List:flatMap(fn) | |||
| 9 | return result | 9 | return result |
| 10 | end | 10 | end |
| 11 | 11 | ||
| 12 | function pandoc.List:take(n) | ||
| 13 | if n >= #self then return self end | ||
| 14 | |||
| 15 | local result = pandoc.List() | ||
| 16 | |||
| 17 | for i = 1, n do result:insert(self[i]) end | ||
| 18 | |||
| 19 | return result | ||
| 20 | end | ||
| 21 | |||
| 12 | function format_date(date) | 22 | function format_date(date) |
| 13 | if not date then return date end | 23 | if not date then return date end |
| 14 | 24 | ||
| @@ -186,6 +196,8 @@ end | |||
| 186 | function generate_list(meta) | 196 | function generate_list(meta) |
| 187 | if not meta.pages then return nil end | 197 | if not meta.pages then return nil end |
| 188 | 198 | ||
| 199 | local limit = (meta.list_limit and tonumber(pandoc.utils.stringify(meta.list_limit))) or 9999 | ||
| 200 | |||
| 189 | if meta.depth == "1" then | 201 | if meta.depth == "1" then |
| 190 | return meta.pages.all:map(function(p) | 202 | return meta.pages.all:map(function(p) |
| 191 | return { | 203 | return { |
| @@ -200,57 +212,69 @@ function generate_list(meta) | |||
| 200 | end) | 212 | end) |
| 201 | elseif meta.depth == "2" then | 213 | elseif meta.depth == "2" then |
| 202 | return meta.pages.all:map(function(cat) | 214 | return meta.pages.all:map(function(cat) |
| 215 | local allItems = ((cat.pages and cat.pages.all) or pandoc.List()):map(function(p) | ||
| 216 | return { | ||
| 217 | title = p.title, | ||
| 218 | subtitle = p.subtitle, | ||
| 219 | date = p.date, | ||
| 220 | url = p.url, | ||
| 221 | icon = p.icon or cat.icon, | ||
| 222 | post_icon = cat.list_post_icon or meta.list_post_icon, | ||
| 223 | indicator = cat.list_read_indicators, | ||
| 224 | } | ||
| 225 | end) | ||
| 226 | local items = allItems:take(limit) | ||
| 227 | local omitted = #allItems - #items | ||
| 228 | |||
| 203 | return { | 229 | return { |
| 204 | title = cat.title, | 230 | title = cat.title, |
| 205 | content = cat.content, | 231 | content = cat.content, |
| 206 | url = cat.url, | 232 | url = cat.url, |
| 207 | grid = cat.list_grid, | 233 | grid = cat.list_grid, |
| 208 | items = ((cat.pages and cat.pages.all) or pandoc.List()):map(function(p) | 234 | items = items, |
| 209 | return { | 235 | total = tostring(#allItems), |
| 210 | title = p.title, | 236 | omitted = omitted ~= 0 and tostring(omitted), |
| 211 | subtitle = p.subtitle, | ||
| 212 | date = p.date, | ||
| 213 | url = p.url, | ||
| 214 | icon = p.icon or cat.icon, | ||
| 215 | post_icon = cat.list_post_icon or meta.list_post_icon, | ||
| 216 | indicator = cat.list_read_indicators, | ||
| 217 | } | ||
| 218 | end), | ||
| 219 | } | 237 | } |
| 220 | end):filter(function(cat) return #cat.items ~= 0 end) | 238 | end):filter(function(cat) return #cat.items ~= 0 end) |
| 221 | elseif meta.depth == "3" then | 239 | elseif meta.depth == "3" then |
| 222 | return meta.pages.all:map(function(cat) | 240 | return meta.pages.all:map(function(cat) |
| 241 | local allItems = (cat.pages and cat.pages.all or pandoc.List()):flatMap(function(c) | ||
| 242 | if c.pages then | ||
| 243 | return c.pages.all:map(function(p) | ||
| 244 | return { | ||
| 245 | title = p.title, | ||
| 246 | subtitle = p.subtitle, | ||
| 247 | category = c.title, | ||
| 248 | url = p.url, | ||
| 249 | icon = p.icon or c.icon, | ||
| 250 | post_icon = c.list_post_icon or cat.list_post_icon, | ||
| 251 | indicator = c.list_read_indicators, | ||
| 252 | } | ||
| 253 | end) | ||
| 254 | else | ||
| 255 | local l = pandoc.List() | ||
| 256 | l:insert({ | ||
| 257 | title = c.title, | ||
| 258 | subtitle = c.subtitle, | ||
| 259 | url = c.url, | ||
| 260 | icon = c.icon or cat.icon, | ||
| 261 | post_icon = cat.list_post_icon, | ||
| 262 | indicator = cat.list_read_indicators, | ||
| 263 | }) | ||
| 264 | return l | ||
| 265 | end | ||
| 266 | end) | ||
| 267 | local items = allItems:take(limit) | ||
| 268 | local omitted = #allItems - #items | ||
| 269 | |||
| 223 | return { | 270 | return { |
| 224 | title = cat.title, | 271 | title = cat.title, |
| 225 | content = cat.content, | 272 | content = cat.content, |
| 226 | url = cat.url, | 273 | url = cat.url, |
| 227 | grid = cat.list_grid, | 274 | grid = cat.list_grid, |
| 228 | items = (cat.pages and cat.pages.all or pandoc.List()):flatMap(function(c) | 275 | items = items, |
| 229 | if c.pages then | 276 | total = tostring(#allItems), |
| 230 | return c.pages.all:map(function(p) | 277 | omitted = omitted ~= 0 and tostring(omitted), |
| 231 | return { | ||
| 232 | title = p.title, | ||
| 233 | subtitle = p.subtitle, | ||
| 234 | category = c.title, | ||
| 235 | url = p.url, | ||
| 236 | icon = p.icon or c.icon, | ||
| 237 | post_icon = c.list_post_icon or cat.list_post_icon, | ||
| 238 | indicator = c.list_read_indicators, | ||
| 239 | } | ||
| 240 | end) | ||
| 241 | else | ||
| 242 | local l = pandoc.List() | ||
| 243 | l:insert({ | ||
| 244 | title = c.title, | ||
| 245 | subtitle = c.subtitle, | ||
| 246 | url = c.url, | ||
| 247 | icon = c.icon or cat.icon, | ||
| 248 | post_icon = cat.list_post_icon, | ||
| 249 | indicator = cat.list_read_indicators, | ||
| 250 | }) | ||
| 251 | return l | ||
| 252 | end | ||
| 253 | end), | ||
| 254 | } | 278 | } |
| 255 | end):filter(function(cat) return #cat.items ~= 0 end) | 279 | end):filter(function(cat) return #cat.items ~= 0 end) |
| 256 | end | 280 | end |
| @@ -293,7 +317,8 @@ function process(global, parent, meta) | |||
| 293 | meta.pages = | 317 | meta.pages = |
| 294 | process_pages(global, { parent = parent, meta = meta }, meta.list_order, meta.pages) | 318 | process_pages(global, { parent = parent, meta = meta }, meta.list_order, meta.pages) |
| 295 | meta.depth = (meta.pages and find_depth(meta.pages.all)) or "0" | 319 | meta.depth = (meta.pages and find_depth(meta.pages.all)) or "0" |
| 296 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) | 320 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or |
| 321 | resolve_layout(meta.depth)) | ||
| 297 | 322 | ||
| 298 | if meta.date then | 323 | if meta.date then |
| 299 | meta.date = format_date(meta.date) | 324 | meta.date = format_date(meta.date) |
diff --git a/templates/layouts/categorized_list.html b/templates/layouts/categorized_list.html index adeb762..c5a76b2 100644 --- a/templates/layouts/categorized_list.html +++ b/templates/layouts/categorized_list.html | |||
| @@ -8,11 +8,14 @@ $body$ | |||
| 8 | $for(list)$ | 8 | $for(list)$ |
| 9 | <section> | 9 | <section> |
| 10 | <header class="c-card-list__category-header"> | 10 | <header class="c-card-list__category-header"> |
| 11 | <h2 class="c-card-list__category-title"> | 11 | <div> |
| 12 | <a href="$it.url.rel$">$it.title$</a> | 12 | <h2 class="c-card-list__category-title"> |
| 13 | </h2> | 13 | <a href="$it.url.rel$">$it.title$ →</a> |
| 14 | </h2> | ||
| 15 | $if(it.omitted)$<small>$it.omitted$ more</small>$endif$ | ||
| 16 | </div> | ||
| 14 | $if(it.content)$ | 17 | $if(it.content)$ |
| 15 | <small class="c-card-list__category-subtitle">$it.content$</small> | 18 | <small class="c-card-list__category-description">$it.content$</small> |
| 16 | $endif$ | 19 | $endif$ |
| 17 | </header> | 20 | </header> |
| 18 | $if(it.grid)$ | 21 | $if(it.grid)$ |
