Skip to content

Commit

Permalink
strip string backslash escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerigmeyer committed Jul 10, 2024
1 parent bf101bf commit bd74645
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion content/_data/newsletterArchive.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ export default async () => {
});
const archives = res.replace(/^document.write\("/, '').replace(/"\);$/, '');

return archives;
try {
return JSON.parse(`"${archives}"`);
} catch (e) {
// eslint-disable-next-line no-console
console.error('Failed fetching OddNews archive.', e);
return '';
}
};
6 changes: 4 additions & 2 deletions content/oddnews.njk
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ summary: |
) }}
</aside>

{{ layout.title('Latest News') }}
{% if newsletterArchive | length %}
{{ layout.title('Latest News') }}

{{ newsletterArchive | safe }}
{{ newsletterArchive | safe }}
{% endif %}

0 comments on commit bd74645

Please sign in to comment.