Skip to content

Commit 4a85bad

Browse files
authored
fix(giscus): add CORS header for custom theme CSS (#35)
1 parent b6769a0 commit 4a85bad

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

public/_headers

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/giscus-theme.css
2+
Access-Control-Allow-Origin: https://giscus.app

src/components/BlueskyEngagement.astro

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,23 @@ const handle = "codingwithcalvin.net";
129129
if (likesLabel) likesLabel.textContent = likes === 1 ? 'like from' : 'likes from';
130130
if (repostsLabel) repostsLabel.textContent = reposts === 1 ? 'repost from' : 'reposts from';
131131

132-
// Hide likers section if no likes
133-
const likersSection = container.querySelector('.likers-section');
134-
if (likes === 0 && likersSection) {
135-
likersSection.classList.add('hidden');
132+
// Show sad face when no engagement
133+
const sadFaceHtml = `<div class="flex items-center justify-center w-12 h-12 text-text-muted">
134+
<svg class="w-10 h-10" fill="none" stroke="currentColor" viewBox="0 0 24 24">
135+
<circle cx="12" cy="12" r="10" stroke-width="1.5"/>
136+
<circle cx="9" cy="9" r="1" fill="currentColor"/>
137+
<circle cx="15" cy="9" r="1" fill="currentColor"/>
138+
<path stroke-linecap="round" stroke-width="1.5" d="M8 16c1.333-1 2.667-1.5 4-1.5s2.667.5 4 1.5"/>
139+
</svg>
140+
</div>`;
141+
142+
if (likes === 0 && likersAvatars) {
143+
likersAvatars.innerHTML = sadFaceHtml;
136144
}
137145

138-
// Hide reposters section if no reposts
139-
const repostersSection = container.querySelector('.reposters-section');
140-
if (reposts === 0 && repostersSection) {
141-
repostersSection.classList.add('hidden');
146+
const repostersAvatars = container.querySelector('.reposters-avatars');
147+
if (reposts === 0 && repostersAvatars) {
148+
repostersAvatars.innerHTML = sadFaceHtml;
142149
}
143150

144151
// Update Bluesky link
@@ -187,7 +194,6 @@ const handle = "codingwithcalvin.net";
187194
}
188195

189196
// Fetch reposters for avatars (limit to 50)
190-
const repostersAvatars = container.querySelector('.reposters-avatars');
191197
if (reposts > 0 && repostersAvatars) {
192198
const repostsRes = await fetch(
193199
`https://public.api.bsky.app/xrpc/app.bsky.feed.getRepostedBy?uri=${encodeURIComponent(atUri)}&limit=50`

src/pages/rss.xml.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,16 @@ export async function GET(context: APIContext) {
5050
};
5151
}
5252

53+
// Add custom data for bluesky post ID if present
54+
if (post.data.blueskyPostId) {
55+
item.customData = `<bluesky:postId>${post.data.blueskyPostId}</bluesky:postId>`;
56+
}
57+
5358
return item;
5459
}),
60+
xmlns: {
61+
bluesky: 'https://bsky.app/ns',
62+
},
5563
customData: `<language>en-us</language>`,
5664
});
5765
}

0 commit comments

Comments
 (0)