Skip to content

Commit 3e61089

Browse files
committed
add link preconnect to algolia
1 parent be4bad2 commit 3e61089

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/lit-dev-content/.eleventy.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,12 @@ ${content}
451451
return `<script type="module">${script}</script>`;
452452
});
453453

454+
eleventyConfig.addShortcode('algoliaid', () => {
455+
const varsRaw = fsSync.readFileSync('../../public-vars.json', 'utf8');
456+
const vars = JSON.parse(varsRaw);
457+
return vars.algolia.appId;
458+
});
459+
454460
// Source: https://github.com/11ty/eleventy-base-blog/blob/master/.eleventy.js
455461
eleventyConfig.addFilter('readableDate', (dateObj) => {
456462
return luxon.DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat(

packages/lit-dev-content/site/_includes/default.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
<script type="module" src="{{ site.baseurl }}/js/tslib.js"></script>
4242
{% endif %}
4343

44+
<link rel="preconnect" href="https://{% algoliaid %}-dsn.algolia.net/" crossorigin>
45+
4446
<link href="/blog/atom.xml" rel="alternate" type="application/atom+xml" title="Lit Blog feed">
4547
<noscript><style>body[dsd-pending] {display: block !important;}</style></noscript>
4648
{% block head %}{% endblock %}

0 commit comments

Comments
 (0)