feat: all page add pageview

This commit is contained in:
KazooTTT
2024-11-23 21:42:50 +08:00
parent b040521893
commit 99421ebfa4

View File

@ -1,5 +1,10 @@
--- ---
import { Icon } from 'astro-icon/components' import { Icon } from 'astro-icon/components'
import PageViews from '../PageViews'
const pathname = new URL(Astro.request.url).pathname
const isBlogPost = pathname.startsWith('/blog/') && pathname !== '/blog'
const slug = pathname === '/' ? 'home' : pathname.replace(/^\/|\/$/g, '')
--- ---
<footer class='mx-auto mt-24 w-full'> <footer class='mx-auto mt-24 w-full'>
@ -8,52 +13,63 @@ import { Icon } from 'astro-icon/components'
class='flex flex-col items-center gap-y-3 sm:flex sm:flex-row sm:items-center sm:justify-between sm:gap-y-0' class='flex flex-col items-center gap-y-3 sm:flex sm:flex-row sm:items-center sm:justify-between sm:gap-y-0'
> >
<div class='flex gap-x-4 text-sm'> <div class='flex gap-x-4 text-sm'>
<!-- <a
class='inline-flex gap-x-2 text-gray-600 hover:text-gray-800 dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600'
href='/terms'>Terms</a
>
<a
class='inline-flex gap-x-2 text-gray-600 hover:text-gray-800 dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600'
href='/privacy'>Privacy</a
> -->
<p class=''>2024 kazoottt. All rights reserved.</p> <p class=''>2024 kazoottt. All rights reserved.</p>
</div> </div>
<div class='flex items-center justify-between'> <div class='flex items-center justify-between'>
<!-- Social Brands --> <!-- Social Brands -->
<div class='flex items-center gap-x-4'> <div class='flex items-center gap-x-4'>
{
!isBlogPost && (
<div class='text-center'>
<PageViews slug={slug} />
</div>
)
}
<!-- Linkedin --> <!-- Linkedin -->
<a <a
class='inline-block text-muted-foreground transition-all hover:text-muted-foreground/75' class='inline-block text-muted-foreground transition-all hover:text-muted-foreground/75'
href='mailto:work@kazoottt.top' href='mailto:work@kazoottt.top'
aria-label="Email" aria-label='Email'
> >
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-5 h-5"> <svg
<rect width="20" height="16" x="2" y="4" rx="2"/> xmlns='http://www.w3.org/2000/svg'
<path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/> width='20'
height='20'
viewBox='0 0 24 24'
fill='none'
stroke='currentColor'
stroke-width='2'
stroke-linecap='round'
stroke-linejoin='round'
class='h-5 w-5'
>
<rect width='20' height='16' x='2' y='4' rx='2'></rect>
<path d='m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7'></path>
</svg> </svg>
</a> </a>
<a <a
class='inline-block text-muted-foreground transition-all hover:text-muted-foreground/75' class='inline-block text-muted-foreground transition-all hover:text-muted-foreground/75'
href='https://github.com/kazoottt' href='https://github.com/kazoottt'
aria-label="GitHub" aria-label='GitHub'
> >
<Icon name="github" class="w-5 h-5" /> <Icon name='github' class='h-5 w-5' />
</a> </a>
<a <a
class='inline-block text-muted-foreground transition-all hover:text-muted-foreground/75' class='inline-block text-muted-foreground transition-all hover:text-muted-foreground/75'
href='https://x.com/kazoottt' href='https://x.com/kazoottt'
aria-label="Twitter" aria-label='Twitter'
> >
<Icon name="twitter" class="w-5 h-5" /> <Icon name='twitter' class='h-5 w-5' />
</a> </a>
<a <a
class='inline-block text-muted-foreground transition-all hover:text-muted-foreground/75' class='inline-block text-muted-foreground transition-all hover:text-muted-foreground/75'
href='/rss.xml' href='/rss.xml'
aria-label="RSS Feed" aria-label='RSS Feed'
> >
<Icon name="rss" class="w-5 h-5" /> <Icon name='rss' class='h-5 w-5' />
</a> </a>
</div> </div>
<!-- End Social Brands --> <!-- End Social Brands -->