Skip to content

Commit cdf1c15

Browse files
committed
Cross-sell component
1 parent 3b193ea commit cdf1c15

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-1
lines changed

_includes/cross-sell.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<aside class="c-cross-sell">
2+
3+
{% assign random = site.time | date: "%s%N" | modulo: site.posts.size %}
4+
5+
<h4 class="c-cross-sell__title">You might also like…</h4>
6+
<h5 class="c-cross-sell__link"><a href="{{ site.posts[random].url }}"><cite>{{ site.posts[random].title }}</cite></a></h5>
7+
8+
</aside>
9+

_includes/css/csswizardry.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_posts/2025-01-23-build-for-the-web-build-on-the-web-build-with-the-web.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ rewriting entire projects just to maintain feature parity with the previous
2626
iteration. This is not meaningful or productive work—it is time sunk into merely
2727
keeping themselves at square one.
2828

29+
{% include cross-sell.html %}
30+
2931
It’s a form of open-source vendor lock-in, and adding even the most trivial of
3032
performance improvements becomes impossible as frameworks obscure or sometimes
3133
remove the ability to fiddle with the nuts and bolts. The worst thing? You get
@@ -84,6 +86,8 @@ Every layer of abstraction made in the browser moves you further from the
8486
platform, ties you further into framework lock-in, and moves you further away
8587
from fast.
8688

89+
{% include cross-sell.html %}
90+
8791
I remain convinced that the typical developer doesn’t know enough about business
8892
analysis, and the typical business analyst doesn’t know enough about
8993
development, to fully reconcile the two sides of the coin. Deeper and more

css/_components.cross-sell.scss

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* ==========================================================================
2+
#CROSS-SELL
3+
========================================================================== */
4+
5+
/**
6+
* Cross-link other articles from post-to-post.
7+
*/
8+
9+
.c-cross-sell {
10+
width: 50%;
11+
float: left;
12+
margin-right: 12px;
13+
}
14+
15+
.c-cross-sell__title {
16+
font-size: 12px;
17+
line-height: 2;
18+
margin-bottom: 0;
19+
font-weight: bold;
20+
text-transform: uppercase;
21+
color: #999;
22+
}
23+
24+
@media screen and (min-width: 45em) {
25+
.c-cross-sell {
26+
margin-left: -12px;
27+
}
28+
29+
.c-cross-sell:nth-of-type(even) {
30+
float: right;
31+
text-align: right;
32+
margin-right: -12px;
33+
margin-left: 12px;
34+
}
35+
36+
}

css/csswizardry.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
* Footnotes............Article footnote styles
6767
* Embeds...............Embedded Tweets etc. need to look nicer
6868
* Highlights...........Call-outs and highlights.
69+
* Cross-sell...........Linked-articles cross-sell component.
6970
*
7071
* SCOPES
7172
* Post.................Styles scoped specifically to blog post pages
@@ -209,6 +210,7 @@ $inuit-enable-list-ui--small: true;
209210
@import "components.footnotes";
210211
@import "components.embeds";
211212
@import "components.highlights";
213+
@import "components.cross-sell";
212214

213215

214216

0 commit comments

Comments
 (0)