fix(blog): ensure target environment vars are parsed for accurate strict filtering in prod, and integrate face detection gravity for blog thumbnails
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 12s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 12s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
This commit is contained in:
@@ -5,6 +5,7 @@ import { MDXRemote } from 'next-mdx-remote/rsc';
|
|||||||
import { getPostBySlug, getAdjacentPosts, getReadingTime, getHeadings } from '@/lib/blog';
|
import { getPostBySlug, getAdjacentPosts, getReadingTime, getHeadings } from '@/lib/blog';
|
||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
import Image from 'next/image';
|
||||||
import PostNavigation from '@/components/blog/PostNavigation';
|
import PostNavigation from '@/components/blog/PostNavigation';
|
||||||
import PowerCTA from '@/components/blog/PowerCTA';
|
import PowerCTA from '@/components/blog/PowerCTA';
|
||||||
import TableOfContents from '@/components/blog/TableOfContents';
|
import TableOfContents from '@/components/blog/TableOfContents';
|
||||||
@@ -77,10 +78,16 @@ export default async function BlogPost({ params }: BlogPostProps) {
|
|||||||
{/* Featured Image Header */}
|
{/* Featured Image Header */}
|
||||||
{post.frontmatter.featuredImage ? (
|
{post.frontmatter.featuredImage ? (
|
||||||
<div className="relative w-full h-[70vh] min-h-[500px] overflow-hidden group">
|
<div className="relative w-full h-[70vh] min-h-[500px] overflow-hidden group">
|
||||||
<div
|
<div className="absolute inset-0 transition-transform duration-[3s] ease-out scale-110 group-hover:scale-100">
|
||||||
className="absolute inset-0 bg-cover bg-center transition-transform duration-[3s] ease-out scale-110 group-hover:scale-100"
|
<Image
|
||||||
style={{ backgroundImage: `url(${post.frontmatter.featuredImage})` }}
|
src={`${post.frontmatter.featuredImage}?gravity=obj:face`}
|
||||||
/>
|
alt={post.frontmatter.title}
|
||||||
|
fill
|
||||||
|
priority
|
||||||
|
className="object-cover"
|
||||||
|
sizes="100vw"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className="absolute inset-0 bg-gradient-to-t from-neutral-dark via-neutral-dark/40 to-transparent" />
|
<div className="absolute inset-0 bg-gradient-to-t from-neutral-dark via-neutral-dark/40 to-transparent" />
|
||||||
|
|
||||||
{/* Title overlay on image */}
|
{/* Title overlay on image */}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
|
|||||||
{featuredPost && featuredPost.frontmatter.featuredImage && (
|
{featuredPost && featuredPost.frontmatter.featuredImage && (
|
||||||
<>
|
<>
|
||||||
<Image
|
<Image
|
||||||
src={featuredPost.frontmatter.featuredImage}
|
src={`${featuredPost.frontmatter.featuredImage}?gravity=obj:face`}
|
||||||
alt={featuredPost.frontmatter.title}
|
alt={featuredPost.frontmatter.title}
|
||||||
fill
|
fill
|
||||||
className="absolute inset-0 w-full h-full object-cover scale-105 animate-slow-zoom opacity-40 md:opacity-60"
|
className="absolute inset-0 w-full h-full object-cover scale-105 animate-slow-zoom opacity-40 md:opacity-60"
|
||||||
@@ -160,7 +160,7 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
|
|||||||
{post.frontmatter.featuredImage && (
|
{post.frontmatter.featuredImage && (
|
||||||
<div className="relative h-48 md:h-72 overflow-hidden">
|
<div className="relative h-48 md:h-72 overflow-hidden">
|
||||||
<Image
|
<Image
|
||||||
src={post.frontmatter.featuredImage}
|
src={`${post.frontmatter.featuredImage}?gravity=obj:face`}
|
||||||
alt={post.frontmatter.title}
|
alt={post.frontmatter.title}
|
||||||
fill
|
fill
|
||||||
className="w-full h-full object-cover transition-transform duration-1000 group-hover:scale-110"
|
className="w-full h-full object-cover transition-transform duration-1000 group-hover:scale-110"
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ const booleanSchema = z.preprocess((val) => {
|
|||||||
const envExtension = {
|
const envExtension = {
|
||||||
// Project specific overrides or additions
|
// Project specific overrides or additions
|
||||||
AUTH_COOKIE_NAME: z.string().default('klz_gatekeeper_session'),
|
AUTH_COOKIE_NAME: z.string().default('klz_gatekeeper_session'),
|
||||||
|
TARGET: z.string().optional(),
|
||||||
|
NEXT_PUBLIC_TARGET: z.string().optional(),
|
||||||
|
|
||||||
// Gatekeeper specifics not in base
|
// Gatekeeper specifics not in base
|
||||||
GATEKEEPER_URL: z.string().url().default('http://gatekeeper:3000'),
|
GATEKEEPER_URL: z.string().url().default('http://gatekeeper:3000'),
|
||||||
|
|||||||
@@ -23,11 +23,28 @@ export default function imgproxyLoader({
|
|||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if src contains custom gravity query parameter
|
||||||
|
let gravity = 'sm'; // Use smart gravity (content-aware) by default
|
||||||
|
let cleanSrc = src;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Dummy base needed for relative URLs
|
||||||
|
const url = new URL(src, 'http://localhost');
|
||||||
|
const customGravity = url.searchParams.get('gravity');
|
||||||
|
if (customGravity) {
|
||||||
|
gravity = customGravity;
|
||||||
|
url.searchParams.delete('gravity');
|
||||||
|
cleanSrc = src.startsWith('http') ? url.href : url.pathname + url.search;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Fallback if parsing fails
|
||||||
|
}
|
||||||
|
|
||||||
// We use the width provided by Next.js for responsive images
|
// We use the width provided by Next.js for responsive images
|
||||||
// Height is set to 0 to maintain aspect ratio
|
// Height is set to 0 to maintain aspect ratio
|
||||||
return getImgproxyUrl(src, {
|
return getImgproxyUrl(cleanSrc, {
|
||||||
width,
|
width,
|
||||||
resizing_type: 'fit',
|
resizing_type: 'fit',
|
||||||
gravity: 'sm', // Use smart gravity (content-aware) instead of face detection (requires ML)
|
gravity,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user