Clanek s targetUrl se ob kliku preusmeri (302)

This commit is contained in:
sebastjan 2026-08-15 08:30:37 +02:00
parent f4acd541c5
commit 68fe291b55
2 changed files with 5 additions and 0 deletions

View File

@ -64,6 +64,10 @@ export function serveStatic(app: Express) {
try {
const slug = decodeURIComponent(articleMatch[1]);
const article = await storage.getArticleBySlug(slug);
if (article && (article as any).targetUrl) {
res.redirect(302, (article as any).targetUrl);
return;
}
if (article) {
const articleUrl = `${canonicalBase}/article/${article.slug}`;
const imageUrl = ogImageUrl(article.coverImage || "", canonicalBase);

View File

@ -14,6 +14,7 @@ export const articles = pgTable("articles", {
author: varchar("author", { length: 255 }).notNull().default("Folx Music Television"),
featured: boolean("featured").notNull().default(false),
views: integer("views").notNull().default(0),
targetUrl: text("target_url"),
publishedAt: timestamp("published_at").notNull().defaultNow(),
});