Skip to content

Commit

Permalink
feat: add date next to search result headlines
Browse files Browse the repository at this point in the history
Shows the localized date on the right for search results.
  • Loading branch information
dropforge committed Feb 13, 2024
1 parent f92f893 commit 1adee71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 7 additions & 2 deletions myhpi/search/templates/search/search_result.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

<a href="{% pageurl result %}">
<div class="search-result">
<h5>{{ result.title }}</h5>
<hgroup>
<h5>{{ result.title }}</h5>
<time datetime="{{ result.first_published_at|date:"c" }}">
{{ result.first_published_at|date:"SHORT_DATE_FORMAT" }}
</time>
</hgroup>
<span class="text-dark">
{% if result.search_description %}
{{ result.search_description }}
Expand All @@ -12,4 +17,4 @@ <h5>{{ result.title }}</h5>
{% endif %}
</span>
</div>
</a>
</a>
11 changes: 10 additions & 1 deletion myhpi/static/scss/myHPI.scss
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ h1.toc-title::after {
margin: -0.5rem -0.8rem;

.search-result {
hgroup {
display: flex;
justify-content: space-between;

h5 {
hyphens: auto;
}
}

transition: all 0.25s;

padding: 0.5rem 0.8rem;
Expand Down Expand Up @@ -275,4 +284,4 @@ h1.toc-title::after {
margin-top: 50px;
order: 3;
}
}
}

0 comments on commit 1adee71

Please sign in to comment.