[fix] tianli_gpt layout (#429)

This commit is contained in:
星日语 2024-04-10 10:26:03 +08:00 committed by GitHub
parent 511834d6c9
commit c40ac638b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,7 @@
<% if (['all', page.layout].includes(theme.plugins.tianli_gpt.field)) { %>
<%
const { field } = theme.plugins.tianli_gpt;
const matchesField = field === 'all' || field === layout || (field === 'wiki' && page.wiki) || (field === 'topic' && page.topic);
if (matchesField) { %>
<script defer src="<%- theme.plugins.tianli_gpt?.js %>"></script>
<script defer>
window.addEventListener('DOMContentLoaded', (event) => {
@ -8,4 +11,4 @@
}, JSON.parse(`<%- JSON.stringify(theme.plugins.tianli_gpt) %>`)))
});
</script>
<% } %>
<% } %>