chore: update permalink url for blog
This commit is contained in:
@@ -3,6 +3,7 @@ import { Link, Navigate, Route, Routes, useLocation, useParams } from "react-rou
|
||||
import {
|
||||
BLOG_DEFAULT_DESCRIPTION,
|
||||
BLOG_NAME,
|
||||
BLOG_PERMALINK_PREFIX,
|
||||
BLOG_SITE_URL,
|
||||
BLOG_TWITTER_HANDLE
|
||||
} from "./config";
|
||||
@@ -31,6 +32,7 @@ const LOADER_FRAMES = [load1, load2, load3, load4, load5, load6];
|
||||
const FORCE_LOADER_PREVIEW = false;
|
||||
|
||||
const toAbsoluteUrl = (path = "/"): string => new URL(path, BLOG_SITE_URL).toString();
|
||||
const toPermalinkUrl = (path = "/"): string => new URL(path, BLOG_PERMALINK_PREFIX).toString();
|
||||
|
||||
const setMetaTag = (attribute: "name" | "property", key: string, content?: string): void => {
|
||||
if (!content) return;
|
||||
@@ -338,7 +340,9 @@ function PostPage({
|
||||
const bannerTxId = postFrontmatter.banner || post?.frontmatter?.banner || post?.bannerTxId;
|
||||
const publishedDate = getReadableDate(postFrontmatter.date || post?.publishedAt);
|
||||
const updatedDate = getReadableDate(postFrontmatter.updated || post?.updated || undefined);
|
||||
const permalink = post ? toAbsoluteUrl(`/${post.slug}`) : toAbsoluteUrl(location.pathname);
|
||||
const permalink = post
|
||||
? toPermalinkUrl(`/${post.slug}`)
|
||||
: toPermalinkUrl(location.pathname);
|
||||
|
||||
usePageMetadata({
|
||||
title: post ? `${title} | ${BLOG_NAME}` : `${BLOG_NAME} | Post Not Found`,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const BLOG_NAME = "hyperzine";
|
||||
export const BLOG_SITE_URL = "https://zpz3tbjvlwkkrkn2talxgib6plcj62d3r3gpjebyinbcu7oa7bjq.arweave.net";
|
||||
export const BLOG_PERMALINK_PREFIX = "https://386464538491k.arweave.net";
|
||||
export const BLOG_DEFAULT_DESCRIPTION =
|
||||
"A blog about cyberspace decentralization";
|
||||
export const BLOG_TWITTER_HANDLE = "";
|
||||
|
||||
Reference in New Issue
Block a user