Fix Hyvor component to properly compute page ID
Added proper prop handling and fallback for Astro.url.pathname to ensure the page-id is correctly passed to the comments widget. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5a241fa57d
commit
81cca50f34
1 changed files with 7 additions and 1 deletions
|
|
@ -1,10 +1,16 @@
|
||||||
---
|
---
|
||||||
// Hyvor Talk comments component
|
// Hyvor Talk comments component
|
||||||
|
interface Props {
|
||||||
|
pageId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { pageId } = Astro.props;
|
||||||
|
const computedPageId = pageId ?? Astro.url.pathname;
|
||||||
---
|
---
|
||||||
|
|
||||||
<script async src="https://talk.hyvor.com/embed/embed.js" type="module"></script>
|
<script async src="https://talk.hyvor.com/embed/embed.js" type="module"></script>
|
||||||
<hyvor-talk-comments
|
<hyvor-talk-comments
|
||||||
website-id="15040"
|
website-id="15040"
|
||||||
page-id={Astro.url.pathname}
|
page-id={computedPageId}
|
||||||
reactions-text=""
|
reactions-text=""
|
||||||
></hyvor-talk-comments>
|
></hyvor-talk-comments>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue