Skip to content

Commit 9bc9007

Browse files
committed
移除 html 后缀,处理部署后无法加载评论数和 pv的问题
1 parent 1cf617e commit 9bc9007

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/components/waline/PageInfo.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ interface Props {
1010
1111
const { view, comment, class: className, ...props } = Astro.props
1212
13-
const path = Astro.url.pathname
13+
//部署到 github pages 时,路径会带上 .html 后缀, 导致 waline 统计不到
14+
let path = Astro.url.pathname
15+
if (path.endsWith('.html')) path = path.slice(0, -5)
1416
---
1517

1618
<div class={cn('text-base text-sm text-muted-foreground', className)} {...props}>

0 commit comments

Comments
 (0)