Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ layout: false

{% set bio = person.data.bio %}
{% if bio %}
<p class="mt-4 text-[var(--text-muted)] text-sm italic line-clamp-3">"{{ bio | truncate(120) }}"</p>
<p class="mt-4 text-[var(--text-muted)] text-sm italic line-clamp-3">"{{ bio | trim | truncate(120) }}"</p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current check {% if bio %} on line 48 evaluates to true for strings containing only whitespace. With the addition of the trim filter, such cases will now render as an empty pair of quotes ("") within a <p> tag, creating unnecessary vertical space and a minor UI glitch. It is recommended to update the condition on line 48 to {% if bio | trim %} to ensure the bio section only renders when there is actual content.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding the trim filter is a good improvement to ensure the quotes wrap the content tightly. However, there are two points to consider:

  1. Truncation vs. Line-clamp: Using truncate(120) alongside line-clamp-3 is often counter-productive. On most screens, 120 characters will only fill 1-2 lines, leaving the third line empty and making the CSS clamp redundant. Increasing the limit (e.g., to 300) allows the CSS to handle the truncation more responsively across different screen sizes while still providing a safety limit for very long bios.
  2. Whitespace-only strings: If bio contains only whitespace (e.g., " "), the {% if bio %} check on line 48 will pass, but bio | trim will be empty, resulting in empty quotes "" being rendered. Ideally, the bio should be trimmed before the truthiness check on line 48.
          <p class="mt-4 text-[var(--text-muted)] text-sm italic line-clamp-3">"{{ bio | trim | truncate(300) }}"</p>

{% endif %}
</div>

Expand Down
Loading