feat: use RESERVED_TAGS
This commit is contained in:
@@ -3,6 +3,7 @@ import dynamic from "next/dynamic"
|
||||
import { useState } from "react"
|
||||
|
||||
import { useDate } from "~/hooks/useDate"
|
||||
import { RESERVED_TAGS } from "~/lib/constants"
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
|
||||
const DynamicPageContent = dynamic(() => import("../common/PageContent"), {
|
||||
@@ -26,11 +27,10 @@ export const ImportPreview = ({ note }: { note: NoteMetadata }) => {
|
||||
>
|
||||
{date.formatDate(note.date_published!, undefined)}
|
||||
</time>
|
||||
{!!note.tags?.filter((tag) => tag !== "post" && tag !== "page")
|
||||
.length && (
|
||||
{!!note.tags?.filter((tag) => !RESERVED_TAGS.includes(tag)).length && (
|
||||
<span className="xlog-post-tags space-x-1 truncate min-w-0">
|
||||
{note.tags
|
||||
?.filter((tag) => tag !== "post" && tag !== "page")
|
||||
?.filter((tag) => !RESERVED_TAGS.includes(tag))
|
||||
.map((tag) => (
|
||||
<span className="hover:text-zinc-600" key={tag}>
|
||||
#{tag}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { EditButton } from "~/components/site/EditButton"
|
||||
import PostTag from "~/components/site/PostTag"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { RESERVED_TAGS } from "~/lib/constants"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
import { ExpandedCharacter, ExpandedNote, NoteType } from "~/lib/types"
|
||||
|
||||
@@ -24,12 +25,12 @@ export default function PostMeta({
|
||||
<div className="text-zinc-400 mt-5 space-x-5 flex items-center justify-center">
|
||||
<Time isoString={page?.metadata?.content?.date_published} />
|
||||
{page.metadata?.content?.tags?.filter(
|
||||
(tag) => tag !== "post" && tag !== "page",
|
||||
(tag) => !RESERVED_TAGS.includes(tag),
|
||||
).length ? (
|
||||
<>
|
||||
<span className="xlog-post-tags space-x-1 truncate min-w-0">
|
||||
{page.metadata?.content?.tags
|
||||
?.filter((tag) => tag !== "post" && tag !== "page")
|
||||
?.filter((tag) => !RESERVED_TAGS.includes(tag))
|
||||
.map((tag) => <PostTag key={tag} tag={tag} />)}
|
||||
</span>
|
||||
</>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useMemo } from "react"
|
||||
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import { useDate } from "~/hooks/useDate"
|
||||
import { RESERVED_TAGS } from "~/lib/constants"
|
||||
import { getSiteRelativeUrl } from "~/lib/helpers"
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
import { ExpandedNote, PageVisibilityEnum } from "~/lib/types"
|
||||
@@ -63,7 +64,7 @@ export const SiteArchives = () => {
|
||||
for (const page of posts.data.pages) {
|
||||
for (const post of page.list) {
|
||||
post.metadata?.content?.tags?.forEach((tag) => {
|
||||
if (tag !== "post" && tag !== "page") {
|
||||
if (!RESERVED_TAGS.includes(tag)) {
|
||||
if (result.has(tag)) {
|
||||
result.set(tag, result.get(tag) + 1)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user