fix: permalink
This commit is contained in:
@@ -3,7 +3,6 @@ import { Link, Navigate, Route, Routes, useLocation, useParams } from "react-rou
|
|||||||
import {
|
import {
|
||||||
BLOG_DEFAULT_DESCRIPTION,
|
BLOG_DEFAULT_DESCRIPTION,
|
||||||
BLOG_NAME,
|
BLOG_NAME,
|
||||||
BLOG_PERMALINK_PREFIX,
|
|
||||||
BLOG_SITE_URL,
|
BLOG_SITE_URL,
|
||||||
BLOG_TWITTER_HANDLE
|
BLOG_TWITTER_HANDLE
|
||||||
} from "./config";
|
} from "./config";
|
||||||
@@ -45,7 +44,6 @@ const TWITTER_WIDGETS_SCRIPT_ID = "twitter-widgets-script";
|
|||||||
let twitterWidgetsPromise: Promise<void> | null = null;
|
let twitterWidgetsPromise: Promise<void> | null = null;
|
||||||
|
|
||||||
const toAbsoluteUrl = (path = "/"): string => new URL(path, BLOG_SITE_URL).toString();
|
const toAbsoluteUrl = (path = "/"): string => new URL(path, BLOG_SITE_URL).toString();
|
||||||
const toPermalinkUrl = (path = "/"): string => new URL(path, BLOG_PERMALINK_PREFIX).toString();
|
|
||||||
|
|
||||||
const ensureTwitterWidgets = (): Promise<void> => {
|
const ensureTwitterWidgets = (): Promise<void> => {
|
||||||
if (window.twttr?.widgets?.load) return Promise.resolve();
|
if (window.twttr?.widgets?.load) return Promise.resolve();
|
||||||
@@ -404,9 +402,6 @@ function PostPage({
|
|||||||
const bannerTxId = postFrontmatter.banner || post?.frontmatter?.banner || post?.bannerTxId;
|
const bannerTxId = postFrontmatter.banner || post?.frontmatter?.banner || post?.bannerTxId;
|
||||||
const publishedDate = getReadableDate(postFrontmatter.date || post?.publishedAt);
|
const publishedDate = getReadableDate(postFrontmatter.date || post?.publishedAt);
|
||||||
const updatedDate = getReadableDate(postFrontmatter.updated || post?.updated || undefined);
|
const updatedDate = getReadableDate(postFrontmatter.updated || post?.updated || undefined);
|
||||||
const permalink = post
|
|
||||||
? toPermalinkUrl(`/${post.slug}`)
|
|
||||||
: toPermalinkUrl(location.pathname);
|
|
||||||
const metadataTitle =
|
const metadataTitle =
|
||||||
state === "loading"
|
state === "loading"
|
||||||
? `${BLOG_NAME} | Loading`
|
? `${BLOG_NAME} | Loading`
|
||||||
@@ -451,9 +446,6 @@ function PostPage({
|
|||||||
{post.readingTime && <span>{post.readingTime} min read</span>}
|
{post.readingTime && <span>{post.readingTime} min read</span>}
|
||||||
{post.wordCount && <span>{post.wordCount} words</span>}
|
{post.wordCount && <span>{post.wordCount} words</span>}
|
||||||
<span>{post.postTxId.slice(0, 8)}...</span>
|
<span>{post.postTxId.slice(0, 8)}...</span>
|
||||||
<span>
|
|
||||||
<a href={permalink}>[permalink]</a>
|
|
||||||
</span>
|
|
||||||
<span>
|
<span>
|
||||||
<a href={arweaveUrl(post.postTxId)} target="_blank" rel="noreferrer">
|
<a href={arweaveUrl(post.postTxId)} target="_blank" rel="noreferrer">
|
||||||
[arweave]
|
[arweave]
|
||||||
|
|||||||
Reference in New Issue
Block a user