mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 08:53:11 +00:00
- Add Post + Tag collections (notícias/publicações) with tag-based "Esconder" visibility control for electoral-law compliance - Add static SEO routes /[type]/[category]/[slug] plus /[type] and /[type]/[category] listings, with shared header/breadcrumb and PostCard - Recreate the homepage and refresh the site color palette (styles.css) - Add posts/slug/seo utilities and revalidation wiring (documents.ts) - Add live-fetch seed script (scripts/seed-posts.mjs + seed-loader.mjs, db:seed:posts) - Upgrade Payload 3.79.0 -> 3.82.0 (fixes admin relationship-filter crash) - Remove obsolete Header component; add shadcn card/badge/breadcrumb; update AGENTS.md and components rule docs
12 lines
620 B
TypeScript
12 lines
620 B
TypeScript
/** Remove any trailing slash(es) so URLs concatenate predictably. */
|
|
export const stripTrailingSlash = (url: string): string => url.replace(/\/+$/, '')
|
|
|
|
/** Truncate `text` to `max` characters, appending an ellipsis when cut. */
|
|
export const truncate = (text: string, max: number): string =>
|
|
text.length <= max ? text : `${text.slice(0, max - 1).trimEnd()}…`
|
|
|
|
/** Resolve a possibly-relative URL against the site's base URL. */
|
|
export const toAbsoluteUrl = (url: string, siteUrl: string): string =>
|
|
/^https?:\/\//i.test(url)
|
|
? url
|
|
: `${stripTrailingSlash(siteUrl)}${url.startsWith('/') ? '' : '/'}${url}`
|