feat: use site name
This commit is contained in:
@@ -27,6 +27,7 @@ export default function SiteSettingsGeneralPage() {
|
||||
icon: "",
|
||||
banner: undefined,
|
||||
name: "",
|
||||
site_name: "",
|
||||
description: "",
|
||||
ga: "",
|
||||
ua: "",
|
||||
@@ -38,6 +39,7 @@ export default function SiteSettingsGeneralPage() {
|
||||
mime_type: string
|
||||
}
|
||||
name: string
|
||||
site_name: string
|
||||
description: string
|
||||
ga: string
|
||||
ua: string
|
||||
@@ -51,6 +53,7 @@ export default function SiteSettingsGeneralPage() {
|
||||
banner: values.banner,
|
||||
site: subdomain,
|
||||
name: values.name,
|
||||
site_name: values.site_name,
|
||||
description: values.description,
|
||||
ga: values.ga,
|
||||
ua: values.ua,
|
||||
@@ -91,6 +94,8 @@ export default function SiteSettingsGeneralPage() {
|
||||
)
|
||||
!form.getValues("name") &&
|
||||
form.setValue("name", site.data.metadata?.content?.name || "")
|
||||
!form.getValues("site_name") &&
|
||||
form.setValue("site_name", site.data.metadata?.content?.site_name || "")
|
||||
!form.getValues("description") &&
|
||||
form.setValue("description", site.data.metadata?.content?.bio || "")
|
||||
!form.getValues("ga") &&
|
||||
@@ -165,11 +170,22 @@ export default function SiteSettingsGeneralPage() {
|
||||
<div className="mt-5">
|
||||
<Input
|
||||
required
|
||||
label={t("Name") || ""}
|
||||
label={t("Character Name") || ""}
|
||||
id="name"
|
||||
{...form.register("name")}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Input
|
||||
label={t("Site Name") || ""}
|
||||
id="site_name"
|
||||
placeholder={form.getValues("name")}
|
||||
{...form.register("site_name")}
|
||||
help={t(
|
||||
"It will appear in the page title and site header, using the character name by default.",
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<label htmlFor="description" className="form-label">
|
||||
{t("Description")}
|
||||
|
||||
@@ -23,7 +23,9 @@ export async function GET(
|
||||
|
||||
const data = {
|
||||
version: "https://jsonfeed.org/version/1",
|
||||
title: "Comments on " + site?.metadata?.content?.name,
|
||||
title:
|
||||
"Comments on " + site?.metadata?.content?.site_name ||
|
||||
site?.metadata?.content?.name,
|
||||
description: site?.metadata?.content?.bio,
|
||||
icon: site?.metadata?.content?.avatars?.[0],
|
||||
home_page_url: link,
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function GET(
|
||||
})
|
||||
const data = {
|
||||
version: "https://jsonfeed.org/version/1",
|
||||
title: site?.metadata?.content?.name,
|
||||
title: site?.metadata?.content?.site_name || site?.metadata?.content?.name,
|
||||
description: site?.metadata?.content?.bio,
|
||||
icon: site?.metadata?.content?.avatars?.[0],
|
||||
home_page_url: link,
|
||||
|
||||
@@ -33,7 +33,8 @@ export async function generateMetadata({
|
||||
|
||||
const site = await fetchGetSite(params.site, queryClient)
|
||||
|
||||
const title = site?.metadata?.content?.name || site?.handle
|
||||
const title =
|
||||
site?.metadata?.content?.site_name || site?.metadata?.content?.name
|
||||
const description = site?.metadata?.content?.bio
|
||||
const images =
|
||||
site?.metadata?.content?.avatars || `${SITE_URL}/assets/logo.svg`
|
||||
|
||||
@@ -251,7 +251,8 @@ export const SiteHeader: React.FC<{
|
||||
<div className="flex-1 min-w-0 relative">
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="xlog-site-name text-2xl sm:text-3xl font-bold text-zinc-900 leading-snug break-words min-w-0">
|
||||
{site.data?.metadata?.content?.name}
|
||||
{site.data?.metadata?.content?.site_name ||
|
||||
site.data?.metadata?.content?.name}
|
||||
</h1>
|
||||
<div className="ml-0 sm:ml-8 space-x-3 sm:space-x-4 flex items-center sm:static absolute -bottom-0 right-0">
|
||||
<div className="xlog-site-more-menu relative inline-block align-middle">
|
||||
|
||||
@@ -116,6 +116,10 @@ export const expandCrossbellCharacter = (site: CharacterEntity) => {
|
||||
(expandedCharacter.metadata?.content?.attributes?.find(
|
||||
(a: any) => a.trait_type === "xlog_custom_domain",
|
||||
)?.value as string) || ""
|
||||
expandedCharacter.metadata.content.site_name =
|
||||
(expandedCharacter.metadata?.content?.attributes?.find(
|
||||
(a: any) => a.trait_type === "xlog_site_name",
|
||||
)?.value as string) || ""
|
||||
expandedCharacter.metadata.content.name =
|
||||
expandedCharacter.metadata.content.name || expandedCharacter.handle
|
||||
|
||||
|
||||
@@ -89,7 +89,9 @@
|
||||
"Icon": "图标",
|
||||
"Banner": "横幅",
|
||||
"Supports both pictures and videos.": "支持图片和视频。",
|
||||
"Name": "名称",
|
||||
"Character Name": "角色名称",
|
||||
"Site Name": "站点名称",
|
||||
"It will appear in the page title and site header, using the character name by default.": "它将出现在页面标题和站点顶部,默认使用角色名称。",
|
||||
"Description": "描述",
|
||||
"Integrate Google Analytics": "将 Google Analytics 集成到你的站点中。你可以按照<2>这里</2>的说明查找你的 Measurement ID。",
|
||||
"Integrate Umami Cloud Analytics": "将 Umami Cloud Analytics 集成到你的站点中。你可以按照<2>这里</2>的说明查找你的 Website ID。",
|
||||
|
||||
@@ -104,6 +104,7 @@ export type ExpandedCharacter = CharacterEntity & {
|
||||
ua?: string
|
||||
uh?: string
|
||||
custom_domain?: string
|
||||
site_name?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ export async function updateSite(
|
||||
payload: {
|
||||
site: string
|
||||
name?: string
|
||||
site_name?: string
|
||||
description?: string
|
||||
icon?: string | null
|
||||
subdomain?: string
|
||||
@@ -195,6 +196,15 @@ export async function updateSite(
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(payload.site_name !== undefined &&
|
||||
payload.site_name !== payload.name
|
||||
? [
|
||||
{
|
||||
trait_type: "xlog_site_name",
|
||||
value: payload.site_name,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
}),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user