Files
BroadcastChannel/src/pages/posts/[id].astro
2024-08-31 16:29:02 +08:00

42 lines
1003 B
Plaintext

---
import { getEnv } from '../../lib/env'
import voidFile from '../../assets/void.png'
import List from '../../components/list.astro'
import { getChannelInfo } from '../../lib/telegram'
const { SITE_URL } = Astro.locals
const channelInfo = await getChannelInfo(Astro)
const post = await getChannelInfo(Astro, {
type: 'post',
id: Astro.params.id,
})
const channel = {
...(channelInfo || {}),
posts: [post],
seo: post,
}
const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
export const prerender = false
---
<List channel={channel} before={false} after={false}>
<div slot="header" id="breadcrumb">
<img
src={channel?.avatar?.startsWith('http') ? staticProxy + channel?.avatar : voidFile.src}
alt={channel?.title}
loading="eager"
class="breadcrumb-avatar"
/>
<div class="breadcrumb-title">
<a href={SITE_URL} class="site-title" title={channel?.title}>
{channel.title}
</a>
</div>
</div>
</List>