diff --git a/CONTRIBUTING-BLOG-POST.md b/CONTRIBUTING-BLOG-POST.md index 8a8d1178..74528b60 100644 --- a/CONTRIBUTING-BLOG-POST.md +++ b/CONTRIBUTING-BLOG-POST.md @@ -156,9 +156,11 @@ authors= [ "maury", "jacobim" ] # Leave it out unless you are scheduling; see "Scheduling a post" below. draft = true [extra] - # 'featured' controls whether the blog post appears in the featured section on the main blog page - featured = true - # 'featured_image' sets the main image for the blog header + # 'featured' is for maintainers: `featured = true` makes a post the big + # lead card at the top of /blog/ (the newest featured post leads), so + # leave it out. + # 'featured_image' sets the main image for the blog header. When the post + # is the /blog/ lead, the image is cropped to 16:9 there. # Choose from one of the available images: # "/assets/media/featured/random-01.webp" # "/assets/media/featured/random-02.webp" diff --git a/sass/_cards.scss b/sass/_cards.scss index 2fde9909..19ed8a7b 100644 --- a/sass/_cards.scss +++ b/sass/_cards.scss @@ -1,7 +1,8 @@ // Cards: white cards on a light canvas, the design /community/ introduced. -// The homepage is built from it. The canvas (.community-home-canvas), section -// head and label (.community-home-section-head, .community-home-kicker), and -// the logo strip are /community/'s, in _community.scss. +// The homepage, /blog/ and blog posts are built from it. The canvas +// (.community-home-canvas), section head and label +// (.community-home-section-head, .community-home-kicker), and the logo strip +// are /community/'s, in _community.scss. // // Imported before _community.scss, which takes its palette and the card // surface from here. @@ -20,6 +21,19 @@ $community-ink: #072150; box-shadow: 0 12px 32px rgba(60, 60, 130, 0.16); } +// A card's section label: sentence case in #4a5ad8, the hero button blue, +// which is 5.6:1 on white where /community/'s #5b6fff kicker is 4.1:1. +// 2.4rem keeps it above the homepage cards' titles, the largest of which is +// 1.8rem. Balanced wrapping avoids leaving "releases" alone on a line. +@mixin card-label { + color: #4a5ad8; + font-size: 2.4rem; + font-weight: 600; + letter-spacing: normal; + text-transform: none; + text-wrap: balance; +} + // Homepage (templates/index.html) ------------------------------------------- // Every block below the hero is a card on .community-home-canvas. Two columns @@ -64,18 +78,9 @@ $community-ink: #072150; margin-bottom: 0; } - // Sentence-case section labels; /community/ keeps the uppercase kicker. - // #4a5ad8 is the hero button blue: 5.6:1 on white, where the kicker's - // #5b6fff is 4.1:1. 2.4rem keeps them above the cards' titles, the largest - // of which is 1.8rem. Balanced wrapping avoids leaving "releases" alone on - // a line. + // /community/ keeps the uppercase kicker. .community-home-kicker { - color: #4a5ad8; - font-size: 2.4rem; - font-weight: 600; - letter-spacing: normal; - text-transform: none; - text-wrap: balance; + @include card-label; // The release card's label is a heading around a link; it looks like // the "Valkey participants" link label. @@ -223,3 +228,385 @@ $community-ink: #072150; line-height: 1.5; } } + +// Blog landing page (templates/blog.html, macros/blog.html) ------------------ + +// No banner: a big lead card for the newest featured post, then the type +// pills and one list card with a row per post. +.blog-landing { + display: grid; + gap: 4rem; + max-width: var(--max-width); + margin: 3.4rem auto 4.8rem; +} + +// A 16:9 frame for the lead image, or the banner gradient and Valkey mark +// when there is none. +.blog-media { + position: relative; + aspect-ratio: 16 / 9; + overflow: hidden; + background: linear-gradient(135deg, rgb(59, 42, 102), rgb(78, 81, 191)); + + img { + display: block; + width: 100%; + height: 100%; + object-fit: cover; + } +} + +.blog-media-empty::after { + content: ''; + position: absolute; + inset: 0; + background: rgba(255, 255, 255, 0.9); + mask: url('/img/Valkey-logo.svg') center / auto 36% no-repeat; + -webkit-mask: url('/img/Valkey-logo.svg') center / auto 36% no-repeat; +} + +// Type label: a dot in the type's badge colour, then the name. +.blog-type { + display: inline-flex; + align-items: center; + gap: 0.6rem; + color: #47506b; + font-size: 1.3rem; + font-weight: 600; + line-height: 1.2; + + &::before { + content: ''; + flex: 0 0 auto; + width: 0.8rem; + height: 0.8rem; + border-radius: 50%; + background: $grey-dk-200; + } + + @each $type, $color in $blog-type-colors { + &[data-type="#{$type}"]::before { background: $color; } + } +} + +.blog-byline { + display: flex; + align-items: center; + gap: 1rem; + min-width: 0; + color: #606985; + font-size: 1.3rem; + line-height: 1.35; + + time { + display: block; + } +} + +.blog-avatars { + display: flex; + flex: 0 0 auto; + + &:empty { + display: none; + } + + img, + .blog-avatar-initials { + width: 2.8rem; + height: 2.8rem; + border: 2px solid #fff; + border-radius: 50%; + background: #e9ebf4; + } + + img { + object-fit: cover; + } + + > * + * { + margin-left: -0.9rem; + } +} + +.blog-avatar-initials { + display: inline-flex; + align-items: center; + justify-content: center; + color: $community-purple-800; + font-size: 1.05rem; + font-weight: 700; +} + +.blog-byline-names { + display: block; + color: $community-ink; + font-weight: 600; +} + +// Lead post: image beside the text once the card is wide enough. +.blog-lead { + @include card; + display: grid; + gap: 2rem; + padding: 1.4rem; + + @include respond-min(768px) { + grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); + align-items: center; + gap: 3.4rem; + padding: 1.8rem; + } + + .blog-media { + border-radius: 12px; + } + + .blog-avatars img, + .blog-avatars .blog-avatar-initials { + width: 3.4rem; + height: 3.4rem; + } + + &:hover .blog-lead-title { + text-decoration: underline; + } + + &:focus-visible { + outline: 2px solid $community-blue-500; + outline-offset: 3px; + } +} + +.blog-lead-body { + padding: 0 0.8rem 1rem; + + @include respond-min(768px) { + padding: 1rem 2.4rem 1rem 0; + } +} + +.blog-lead-kicker { + display: flex; + margin: 0; +} + +.blog-lead-title { + margin: 1.2rem 0 1.2rem; + color: $community-ink; + font-size: 2.6rem; + font-weight: 700; + line-height: 1.2; + letter-spacing: -0.01em; + + @include respond-min(1100px) { + font-size: 3.4rem; + } +} + +.blog-lead-description { + display: -webkit-box; + margin: 0 0 2.2rem; + overflow: hidden; + color: #47506b; + font-size: 1.7rem; + line-height: 1.55; + -webkit-line-clamp: 4; + -webkit-box-orient: vertical; +} + +// The type pills above the list. +.blog-filter { + display: flex; + flex-wrap: wrap; + gap: 0.8rem; + margin-bottom: 1.6rem; + + &[hidden] { + display: none; + } + + button { + display: inline-flex; + align-items: center; + padding: 0.7rem 1.4rem; + border: 1px solid #d5daea; + border-radius: 999px; + background: #fff; + color: #47506b; + font: inherit; + font-size: 1.3rem; + font-weight: 700; + line-height: 1.2; + cursor: pointer; + transition: background 0.15s, border-color 0.15s, color 0.15s; + + &:hover { + border-color: $community-purple-800; + color: $community-purple-800; + } + + &:focus-visible { + outline: 2px solid $community-blue-500; + outline-offset: 2px; + } + + &[aria-pressed="true"] { + border-color: $community-purple-800; + background: $community-purple-800; + color: #fff; + } + } + + .blog-type { + color: inherit; + font-weight: inherit; + } +} + +// One white card; each row is a link, split from the next by the homepage's +// hairline. From 1100px the byline, type and date sit in columns, so they line +// up down the list. +.blog-list { + @include card; + margin: 0; + padding: 0.6rem 2rem; + list-style: none; + + @include respond-min(768px) { + padding: 0.8rem 3.4rem; + } + + // Every shown row but the first; the filter hides rows, the lead among them. + li:not([hidden]) ~ li:not([hidden]) { + border-top: 1px solid #e9ebf4; + } +} + +.blog-row { + display: grid; + grid-template-columns: auto minmax(0, 1fr); + grid-template-areas: + "type date" + "text text" + "byline byline"; + align-items: center; + gap: 0.8rem 1.4rem; + padding: 1.8rem 0; + + @include respond-min(1100px) { + grid-template-columns: minmax(0, 1fr) 24rem 17rem 10rem; + grid-template-areas: "text byline type date"; + gap: 2.4rem; + padding: 2rem 0; + } + + &:hover .blog-row-title { + text-decoration: underline; + } + + &:focus-visible { + outline: 2px solid $community-blue-500; + outline-offset: 2px; + } + + .blog-byline { + grid-area: byline; + } +} + +.blog-row-text { + grid-area: text; + min-width: 0; +} + +.blog-row-title { + margin: 0; + color: $community-ink; + font-size: 1.7rem; + font-weight: 700; + line-height: 1.35; +} + +.blog-row-description { + display: -webkit-box; + margin: 0.4rem 0 0; + overflow: hidden; + color: #47506b; + font-size: 1.4rem; + line-height: 1.5; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +.blog-row-type { + grid-area: type; +} + +.blog-row-date { + grid-area: date; + color: #606985; + font-size: 1.3rem; + font-variant-numeric: tabular-nums; + white-space: nowrap; + + @include respond-min(1100px) { + text-align: right; + } +} + +.blog-no-results { + margin: 0; + color: #606985; + font-size: 1.5rem; +} + +// The live count under the list, and the point that loads the next batch +// as it nears the viewport. +.blog-status { + margin: 2.4rem 0 0; + color: #606985; + font-size: 1.3rem; + text-align: center; +} + +.blog-sentinel { + height: 1px; +} + +// Blog posts (templates/blog-single.html) ------------------------------------ + +// The article and the sidebar are white cards on .community-home-canvas. +// The article's type rules are in _valkey.scss. +.blog-single { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: 2rem; + max-width: var(--max-width); + margin: 3.4rem auto; + + @include respond-min(1024px) { + grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); + align-items: start; + } + + // "About the authors". + .blog-authors h2 { + @include card-label; + margin: 0; + line-height: 1.2; + } + + // The article and the sidebar are the cards. width: auto drops the + // generic .body main/aside column widths. + > main, + > aside { + @include card; + width: auto; + padding: 2.2rem 2rem; + + @include respond-min(768px) { + padding: 2.7rem 3.4rem; + } + } +} diff --git a/sass/_colors.scss b/sass/_colors.scss index 89985b69..25309188 100755 --- a/sass/_colors.scss +++ b/sass/_colors.scss @@ -103,6 +103,15 @@ $text-link-alternate: #0053b8; //pacific blue $text-link-alternate-lighter: #137cc1; //pacific blue tint 1 $text-link-alternate-darker: #00529e; +// Each blog type's colour: the badge on posts and the dot on /blog/. +$blog-type-colors: ( + "Technical Deep Dive": #6983ff, + "Community Highlight": $green-200, + "How-to": $purple-200, + "Announcements": $yellow-100, + "Events": $red-100 +); + @mixin respond-min($width) { @media screen and (min-width: $width) { @content; diff --git a/sass/_valkey.scss b/sass/_valkey.scss index b29b0197..ce1ae988 100644 --- a/sass/_valkey.scss +++ b/sass/_valkey.scss @@ -1088,20 +1088,6 @@ aside { } } -.blog-type-filters { - margin-bottom: 1.5rem; - - select { - padding: 0.4rem 1rem; - border-radius: 8px; - border: 1px solid $grey-lt-300; - background: $white; - color: $text; - font-size: 1.3rem; - cursor: pointer; - } -} - .sr-only { position: absolute; width: 1px; @@ -1122,106 +1108,8 @@ aside { color: $white; background-color: $grey-dk-200; - &[data-type="Technical Deep Dive"] { background-color: #6983ff; } - &[data-type="Community Highlight"] { background-color: $green-200; } - &[data-type="How-to"] { background-color: $purple-200; } - &[data-type="Announcements"] { background-color: $yellow-100; } - &[data-type="Events"] { background-color: $red-100; } -} - -.blog-inner { - - .blog-list { - list-style: none; - margin: 0; - padding: 0; - - li { - background: #fff; - padding: 20px; - margin-bottom: 20px; - - h2 a { - color: #30176e; - margin: 0; - } - - a.link-readmore { - color: #747bff ; - } - - .meta { - margin-top: 2px; - } - } - } -} - -.blog-featured { - h2 { - color: #30176e; - margin-bottom: 1rem; - font-size: 120%; - } - - &-card { - display: flex; - background: #fff; - border-radius: 10px; - margin-bottom: 2rem; - - img { - max-width: 50%; - height: auto; - object-fit: cover; - border-top-left-radius: 10px; - border-bottom-left-radius: 10px; - } - - .info { - flex: 1 1 50%; - width: 50%; - padding: 1.25rem; - - h4 { - margin: 0 0 1.25rem; - -webkit-box-orient: vertical; - overflow: hidden; - - a { - color: #000; - } - } - - p { - margin: 0 0 1.25rem; - display: -webkit-box; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - overflow: hidden; - } - - .read-more { - - } - } - .read-more { - display: inline-flex; - align-items: center; - justify-content: center; - position: relative; - line-height: 1.2; - font-weight: 600; - font-size: 14px; - padding: 12px 24px; - border: 1px solid #e2e8f0; - border-radius: 50px; - color: #2d3748; - align-self: flex-end; - margin-left: auto; - transition: all 0.2s; - } - + @each $type, $color in $blog-type-colors { + &[data-type="#{$type}"] { background-color: $color; } } } @@ -1270,15 +1158,6 @@ aside { } .blog-single { - display: flex; - flex-wrap: wrap; - width: 100%; - background-color: #e2e8f0; - display: flex; - max-width: var(--max-width); - margin-left: auto; - margin-right: auto; - h2 { font-size: 1.5rem; margin: 0 0 0.25rem 0; @@ -1287,21 +1166,7 @@ aside { text-transform: uppercase; } - main { - flex: 1; - padding: 2rem; - width: 100%; - - @include respond-min(1024px) { - width: 67%; - } - } - .main-inner { - width: 100%; - background-color: #fff; - padding: 1rem 2rem 2rem; - .feature-img { object-fit: cover; width: 100%; @@ -1346,22 +1211,6 @@ aside { margin-bottom: 2rem; } } - - aside { - background-color: #f1f0fa; - padding: 2rem; - width: 100%; - - @include respond-min(768px) { - max-width: 33%; - } - } -} - -.blog-authors { - h2 { - color: #553c9a; - } } .author-container { diff --git a/templates/blog-aside.html b/templates/blog-aside.html deleted file mode 100644 index e1dc1978..00000000 --- a/templates/blog-aside.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "default.html" %} - -{% block content %} -{% block subhead_content %}{% endblock subhead_content %} -
{{ section.description }}
-{{< blog_type name={lead_types | first} />}}
+ {% endif %} +{{ lead.description | safe }}
+ {{< blog_byline post={lead} />}} +