Skip to content

Commit

Permalink
Fixed title not resetting for empty texts
Browse files Browse the repository at this point in the history
  • Loading branch information
revolter committed Jun 11, 2024
1 parent 2fd1889 commit 12aa5c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@
}

function updateTitle(value) {
document.title = '{{ site.tagline }}';

const rawTitle = value.split('\n', 1)[0];
if (rawTitle === '') { return; }
const truncatedTitle = truncate(rawTitle.trim(), 30);
document.title = truncatedTitle + ' | ' + '{{ site.tagline }}';
document.title = truncatedTitle + ' | ' + document.title;
}

function truncate(string, limit) {
Expand Down

0 comments on commit 12aa5c7

Please sign in to comment.