Skip to content

Commit

Permalink
✨ add recommended article relevance and put placeholder first
Browse files Browse the repository at this point in the history
  • Loading branch information
mickm3n committed Jul 26, 2024
1 parent 8ea5baa commit 6f79868
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions static/site/styles/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,12 @@ tr:first-child th {
text-transform: uppercase;
}

.article-relevance {
color: #e74c3c;
font-size: 0.85rem;
text-align: right;
}

.article-date {
color: #7f8c8d;
}
Expand Down
5 changes: 4 additions & 1 deletion templates/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h1><a class="no-underline " href="{{ page.permalink }}">{{ page.title }}</a></h
</p>
{% endmacro post_link %}

{% macro card(nn_page) %}
{% macro card(nn_page, relevance) %}
{% if nn_page.extra.image %}
{% set image = config.base_url ~ nn_page.path ~ nn_page.extra.image %}
{% else %}
Expand All @@ -70,6 +70,9 @@ <h1><a class="no-underline " href="{{ page.permalink }}">{{ page.title }}</a></h
<img src="{{ image }}">
</div>
<div class="article-info">
<div class="article-relevance">
<span>{{ relevance }} 相關</span>
</div>
<div class="article-meta">
<span class="article-category">{{ breadcrumb | safe }}</span>
<span class="article-date">{{ nn_page.date }}</span>
Expand Down
2 changes: 1 addition & 1 deletion templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h2>相關文章推薦</h2>
{% set top_3_nn_paths = top_3_nn[page.path] | split(pat=":") %}
{% for path in top_3_nn_paths %}
{% set nn_page = get_page(path=path) %}
{{ macro::card(nn_page=nn_page) }}
{{ macro::card(nn_page=nn_page, relevance="70%") }}
{% endfor %}
{% endif %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/reading-note.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h2>相關文章推薦</h2>
{% set top_3_nn_paths = top_3_nn[page.path] | split(pat=":") %}
{% for path in top_3_nn_paths %}
{% set nn_page = get_page(path=path) %}
{{ macro::card(nn_page=nn_page) }}
{{ macro::card(nn_page=nn_page, relevance="70%") }}
{% endfor %}
{% endif %}
</div>
Expand Down

0 comments on commit 6f79868

Please sign in to comment.