Clanek s targetUrl se ob kliku preusmeri (302)
This commit is contained in:
parent
f4acd541c5
commit
68fe291b55
@ -64,6 +64,10 @@ export function serveStatic(app: Express) {
|
|||||||
try {
|
try {
|
||||||
const slug = decodeURIComponent(articleMatch[1]);
|
const slug = decodeURIComponent(articleMatch[1]);
|
||||||
const article = await storage.getArticleBySlug(slug);
|
const article = await storage.getArticleBySlug(slug);
|
||||||
|
if (article && (article as any).targetUrl) {
|
||||||
|
res.redirect(302, (article as any).targetUrl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (article) {
|
if (article) {
|
||||||
const articleUrl = `${canonicalBase}/article/${article.slug}`;
|
const articleUrl = `${canonicalBase}/article/${article.slug}`;
|
||||||
const imageUrl = ogImageUrl(article.coverImage || "", canonicalBase);
|
const imageUrl = ogImageUrl(article.coverImage || "", canonicalBase);
|
||||||
|
|||||||
@ -14,6 +14,7 @@ export const articles = pgTable("articles", {
|
|||||||
author: varchar("author", { length: 255 }).notNull().default("Folx Music Television"),
|
author: varchar("author", { length: 255 }).notNull().default("Folx Music Television"),
|
||||||
featured: boolean("featured").notNull().default(false),
|
featured: boolean("featured").notNull().default(false),
|
||||||
views: integer("views").notNull().default(0),
|
views: integer("views").notNull().default(0),
|
||||||
|
targetUrl: text("target_url"),
|
||||||
publishedAt: timestamp("published_at").notNull().defaultNow(),
|
publishedAt: timestamp("published_at").notNull().defaultNow(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user