From 56f28f7e3fc01a017fc985abe96d35b80d0f8067 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Wed, 13 Mar 2024 16:18:47 -0700 Subject: [PATCH] chore: add recent links widget --- package.json | 2 +- src/_includes/now.liquid | 2 +- src/_includes/partials/addon-links.liquid | 8 +++++ .../partials/now/albumReleases.liquid | 2 +- src/_includes/partials/now/links.liquid | 15 --------- src/_includes/partials/now/media-grid.liquid | 2 +- src/_includes/partials/popular-posts.liquid | 32 ++++++++----------- src/_includes/partials/recent-links.liquid | 15 +++++++++ src/_includes/partials/tags.liquid | 6 ++-- src/_includes/post.liquid | 2 +- src/assets/styles/components/addon-links.css | 19 +++++++++++ src/assets/styles/components/media-grid.css | 2 +- .../styles/components/popular-posts.css | 3 -- src/assets/styles/index.css | 12 +++++-- src/assets/styles/pages/404.css | 3 +- src/assets/styles/pages/now.css | 8 +++-- src/pages/404.html | 4 +-- src/pages/contact-success.html | 4 +-- src/pages/now.html | 4 +-- src/pages/search.html | 4 +-- ...cs-to-json-surfacing-anticipated-albums.md | 2 +- .../2024/link-blogging-using-readwise.md | 2 +- 22 files changed, 91 insertions(+), 62 deletions(-) create mode 100644 src/_includes/partials/addon-links.liquid delete mode 100644 src/_includes/partials/now/links.liquid create mode 100644 src/_includes/partials/recent-links.liquid create mode 100644 src/assets/styles/components/addon-links.css delete mode 100644 src/assets/styles/components/popular-posts.css diff --git a/package.json b/package.json index ec9340b3..a96e68aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "7.9.3", + "version": "7.10.0", "description": "The source for my personal site. Built using 11ty.", "type": "module", "scripts": { diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid index 608401c9..d62e7b7c 100644 --- a/src/_includes/now.liquid +++ b/src/_includes/now.liquid @@ -12,7 +12,7 @@ layout: default {% render "partials/now/media-grid.liquid", data:albums, icon: "vinyl", title: "Albums", shape: "square", count: 8 %} {% render "partials/now/albumReleases.liquid", albumReleases:albumReleases %} {% render "partials/now/media-grid.liquid", data:books, icon: "books", title: "Books", shape: "vertical", count: 6 %} -{% render "partials/now/links.liquid", links:links %} +{% render "partials/recent-links.liquid", links:links %} {% render "partials/now/media-grid.liquid", data:movies, icon: "movie", title: "Movies", shape: "vertical", count: 6 %} {% render "partials/now/media-grid.liquid", data:tv, icon: "device-tv", title: "TV", shape: "vertical", count: 6 %}

diff --git a/src/_includes/partials/addon-links.liquid b/src/_includes/partials/addon-links.liquid new file mode 100644 index 00000000..26a70e0a --- /dev/null +++ b/src/_includes/partials/addon-links.liquid @@ -0,0 +1,8 @@ +{% capture css %} + {% render "../../assets/styles/components/addon-links.css" %} +{% endcapture %} + +

\ No newline at end of file diff --git a/src/_includes/partials/now/albumReleases.liquid b/src/_includes/partials/now/albumReleases.liquid index 02686395..6e589e45 100644 --- a/src/_includes/partials/now/albumReleases.liquid +++ b/src/_includes/partials/now/albumReleases.liquid @@ -1,5 +1,5 @@ {% if albumReleases.size > 0 %} -

+

{% tablericon "calendar-time" "Anticipated albums" %} Anticipated albums

diff --git a/src/_includes/partials/now/links.liquid b/src/_includes/partials/now/links.liquid deleted file mode 100644 index f6d508b1..00000000 --- a/src/_includes/partials/now/links.liquid +++ /dev/null @@ -1,15 +0,0 @@ -{% if links.size > 0 %} - - -{% endif %} diff --git a/src/_includes/partials/now/media-grid.liquid b/src/_includes/partials/now/media-grid.liquid index 64db184d..d75e7f94 100644 --- a/src/_includes/partials/now/media-grid.liquid +++ b/src/_includes/partials/now/media-grid.liquid @@ -7,7 +7,7 @@ {% endif %} {% assign media = data | normalizeMedia %} -

+

{% tablericon icon title %} {{ title }}

diff --git a/src/_includes/partials/popular-posts.liquid b/src/_includes/partials/popular-posts.liquid index 6bff1f7e..8f932b8b 100644 --- a/src/_includes/partials/popular-posts.liquid +++ b/src/_includes/partials/popular-posts.liquid @@ -1,20 +1,14 @@ -{% capture css %} - {% render "../../assets/styles/components/popular-posts.css" %} -{% endcapture %} - {% assign posts = posts | getPopularPosts: analytics %} - \ No newline at end of file +

+ {% tablericon "flame" "Popular" %} + Popular posts +

+ \ No newline at end of file diff --git a/src/_includes/partials/recent-links.liquid b/src/_includes/partials/recent-links.liquid new file mode 100644 index 00000000..4903e9e8 --- /dev/null +++ b/src/_includes/partials/recent-links.liquid @@ -0,0 +1,15 @@ +{% if links.size > 0 %} + + +{% endif %} diff --git a/src/_includes/partials/tags.liquid b/src/_includes/partials/tags.liquid index 3ffc99fa..f83849f1 100644 --- a/src/_includes/partials/tags.liquid +++ b/src/_includes/partials/tags.liquid @@ -1,4 +1,6 @@ {% assign filteredTags = tags | filterTags %} -{% for tag in filteredTags limit: 10 %} + + {% for tag in filteredTags limit: 10 %} {{ tag | formatTag }} -{% endfor %} \ No newline at end of file + {% endfor %} + \ No newline at end of file diff --git a/src/_includes/post.liquid b/src/_includes/post.liquid index 3b305497..e808efe5 100644 --- a/src/_includes/post.liquid +++ b/src/_includes/post.liquid @@ -29,4 +29,4 @@ schema: blog {% render "partials/mastodon-post.liquid", postUrl:postUrl, linkPosts:linkPosts %} -{% render "partials/popular-posts.liquid", posts:collections.posts, analytics:analytics %} \ No newline at end of file +{% render "partials/addon-links.liquid", posts:collections.posts, analytics:analytics, links:links %} \ No newline at end of file diff --git a/src/assets/styles/components/addon-links.css b/src/assets/styles/components/addon-links.css new file mode 100644 index 00000000..24655a0d --- /dev/null +++ b/src/assets/styles/components/addon-links.css @@ -0,0 +1,19 @@ +:root { + --grid: repeat(1,minmax(0,1fr)); +} + +.addon-links__wrapper { + display: grid; + gap: var(--sizing-sm); + grid-template-columns: var(--grid); +} + +.addon-links__wrapper h2 { + margin-top: 0; +} + +@media screen and (min-width: 768px) { + :root { + --grid: repeat(2,minmax(0,1fr)); + } +} \ No newline at end of file diff --git a/src/assets/styles/components/media-grid.css b/src/assets/styles/components/media-grid.css index a0559bf2..66580f0d 100644 --- a/src/assets/styles/components/media-grid.css +++ b/src/assets/styles/components/media-grid.css @@ -3,7 +3,7 @@ --grid-vertical: repeat(3,minmax(0,1fr)); } -.now__section--header { +h2 { margin: var(--sizing-3xl) 0 var(--sizing-lg); } diff --git a/src/assets/styles/components/popular-posts.css b/src/assets/styles/components/popular-posts.css deleted file mode 100644 index 94d70ede..00000000 --- a/src/assets/styles/components/popular-posts.css +++ /dev/null @@ -1,3 +0,0 @@ -.popular-posts h2 { - margin: var(--sizing-base) 0; -} \ No newline at end of file diff --git a/src/assets/styles/index.css b/src/assets/styles/index.css index 34b267ca..9cae98e8 100644 --- a/src/assets/styles/index.css +++ b/src/assets/styles/index.css @@ -325,12 +325,15 @@ article p:first-of-type { margin-top: var(--sizing-sm); } -.tag:not(:last-child) { - margin-right: var(--sizing-lg); +.tag { margin-bottom: var(--sizing-lg); display: inline-block; } +.tag:not(:last-child) { + margin-right: var(--sizing-lg); +} + /* buttons */ button { appearance: none; @@ -464,9 +467,12 @@ li { margin-top: var(--sizing-md); } + .tag { + margin-bottom: var(--sizing-sm); + } + .tag:not(:last-child) { margin-right: var(--sizing-sm); - margin-bottom: var(--sizing-sm); } footer nav:first-child { diff --git a/src/assets/styles/pages/404.css b/src/assets/styles/pages/404.css index b1aa5531..2417b9a3 100644 --- a/src/assets/styles/pages/404.css +++ b/src/assets/styles/pages/404.css @@ -1,4 +1,3 @@ -.four-oh-four__wrapper .image__banner, -.four-oh-four__wrapper a { +.four-oh-four__wrapper .image__banner { margin-bottom: var(--sizing-base); } \ No newline at end of file diff --git a/src/assets/styles/pages/now.css b/src/assets/styles/pages/now.css index 733065ff..36c6402e 100644 --- a/src/assets/styles/pages/now.css +++ b/src/assets/styles/pages/now.css @@ -14,11 +14,15 @@ width: var(--sizing-base); } -.now__section--header { +h2 { margin: var(--sizing-3xl) 0 var(--sizing-lg); } -.now__section--header:first-of-type { +h2:first-of-type { + margin-top: 0; +} + +.link__list { margin-top: 0; } diff --git a/src/pages/404.html b/src/pages/404.html index ad086dd1..1a09d94a 100644 --- a/src/pages/404.html +++ b/src/pages/404.html @@ -15,8 +15,8 @@ image: /assets/img/404.jpg What kind of idiots do you have working here? Hurry up and skip out on the room service bill!
- {% render "partials/tags.liquid", tags:collections.tagsSortedByCount %} - {% render "partials/popular-posts.liquid", posts:collections.posts, analytics:analytics %} + {% render "partials/tags.liquid", tags:collections.tagsSortedByCount, hasSpace:true %} + {% render "partials/addon-links.liquid", posts:collections.posts, analytics:analytics, links:links %}