mirror of
https://github.com/d0zingcat/BroadcastChannel.git
synced 2026-05-13 15:09:12 +00:00
feat: enhance SEO settings and improve title extraction
- Prioritize SEO settings from page data over environment variables - Improve title extraction logic to handle new line characters - Set SEO parameters for specific pages to improve search visibility
This commit is contained in:
@@ -22,8 +22,8 @@ const seoParams = {
|
||||
title: seo?.title,
|
||||
description: seo?.text ?? channel?.description,
|
||||
canonical,
|
||||
noindex: getEnv(import.meta.env, Astro, 'NOINDEX'),
|
||||
nofollow: getEnv(import.meta.env, Astro, 'NOFOLLOW'),
|
||||
noindex: seo?.noindex ?? getEnv(import.meta.env, Astro, 'NOINDEX'),
|
||||
nofollow: seo?.nofollow ?? getEnv(import.meta.env, Astro, 'NOFOLLOW'),
|
||||
openGraph: {
|
||||
basic: {
|
||||
type: 'website',
|
||||
@@ -33,7 +33,7 @@ const seoParams = {
|
||||
},
|
||||
optional: {
|
||||
description: seo?.text ?? channel?.description,
|
||||
locale: getEnv(import.meta.env, Astro, 'LOCALE'),
|
||||
locale,
|
||||
},
|
||||
},
|
||||
extend: {
|
||||
|
||||
@@ -131,7 +131,7 @@ function getPost($, item, { channel, staticProxy, index = 0 }) {
|
||||
const content = $(item).find('.js-message_reply_text')?.length > 0
|
||||
? modifyHTMLContent($, $(item).find('.tgme_widget_message_text.js-message_text'), { index })
|
||||
: modifyHTMLContent($, $(item).find('.tgme_widget_message_text'), { index })
|
||||
const title = content?.text()?.match(/^.*?(?=[。::]|http\S)/g)?.[0] ?? content?.text() ?? ''
|
||||
const title = content?.text()?.match(/^.*?(?=[。\n]|http\S)/g)?.[0] ?? content?.text() ?? ''
|
||||
const id = $(item).attr('data-post')?.replace(new RegExp(`${channel}/`, 'i'), '')
|
||||
|
||||
const tags = $(content).find('a[href^="?q="]')?.each((_index, a) => {
|
||||
|
||||
@@ -5,6 +5,10 @@ import { getChannelInfo } from '../../lib/telegram'
|
||||
const channel = await getChannelInfo(Astro, {
|
||||
after: Astro.params.cursor,
|
||||
})
|
||||
|
||||
channel.seo = {
|
||||
noindex: true,
|
||||
}
|
||||
---
|
||||
|
||||
<List channel={channel} />
|
||||
|
||||
@@ -5,6 +5,10 @@ import { getChannelInfo } from '../../lib/telegram'
|
||||
const channel = await getChannelInfo(Astro, {
|
||||
before: Astro.params.cursor,
|
||||
})
|
||||
|
||||
channel.seo = {
|
||||
noindex: true,
|
||||
}
|
||||
---
|
||||
|
||||
<List channel={channel} />
|
||||
|
||||
@@ -6,6 +6,10 @@ import { getEnv } from '../lib/env'
|
||||
|
||||
const channel = await getChannelInfo(Astro)
|
||||
|
||||
channel.seo = {
|
||||
title: 'Links',
|
||||
}
|
||||
|
||||
const links = (getEnv(import.meta.env, Astro, 'LINKS') || '')
|
||||
.split(';')
|
||||
.filter(Boolean)
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
import List from '../../components/list.astro'
|
||||
import { getChannelInfo } from '../../lib/telegram'
|
||||
|
||||
const q = Astro.url.searchParams.get('q') || Astro.params.q
|
||||
const channel = await getChannelInfo(Astro, {
|
||||
q: Astro.url.searchParams.get('q') || Astro.params.q,
|
||||
q,
|
||||
})
|
||||
|
||||
channel.seo = {
|
||||
title: `${q}`,
|
||||
}
|
||||
---
|
||||
|
||||
<List channel={channel} before={false} after={false} />
|
||||
|
||||
@@ -6,6 +6,10 @@ import { getEnv } from '../lib/env'
|
||||
|
||||
const channel = await getChannelInfo(Astro)
|
||||
|
||||
channel.seo = {
|
||||
title: 'Tags',
|
||||
}
|
||||
|
||||
const tags = (getEnv(import.meta.env, Astro, 'TAGS') || '').split(',')
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user