troubleshooting the blog builds

This commit is contained in:
itsamejms
2026-05-02 09:01:36 +01:00
parent 931063b7c3
commit ccd08dac4e
24 changed files with 351 additions and 620 deletions

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

@@ -1,12 +1,3 @@
---
title: "Best Off-Leash Areas for Dogs in Lagos (and Nearby)"
date: 2025-05-01
description: "Looking for off-leash areas for dogs in Lagos, Portugal? Discover the best spots for safe, enjoyable off-leash walks, plus what to watch out for."
category: Insights
readTime: "6 min"
live: true
---
### **Introduction** ### **Introduction**
Finding a good place to let your dog off-leash in Lagos isnt always straightforward. Finding a good place to let your dog off-leash in Lagos isnt always straightforward.
@@ -23,7 +14,7 @@ Here are some of the best off-leash-friendly areas around Lagos, and how to choo
--- ---
## **1\. Mata Nacional de Barão de São João** ## **1. Mata Nacional de Barão de São João**
**Best for:** Most dogs **Best for:** Most dogs
**Why it works:** **Why it works:**
@@ -36,7 +27,7 @@ Ideal for dogs who need **space without isolation**
--- ---
## **2\. Praia da Bordeira (West Coast)** ## **2. Praia da Bordeira (West Coast)**
**Best for:** High-energy dogs **Best for:** High-energy dogs
**Why it works:** **Why it works:**
@@ -52,7 +43,7 @@ Ideal for dogs who need **space without isolation**
--- ---
## **3\. Ria de Alvor (Quiet Sections)** ## **3. Ria de Alvor (Quiet Sections)**
**Best for:** Lower-energy or calm dogs **Best for:** Lower-energy or calm dogs
**Why it works:** **Why it works:**
@@ -64,7 +55,7 @@ Avoid peak hours, it can get busy
--- ---
## **4\. Monchique Countryside** ## **4. Monchique Countryside**
**Best for:** Dogs needing low stimulation **Best for:** Dogs needing low stimulation
**Why it works:** **Why it works:**
@@ -77,7 +68,7 @@ Great for reactive or sensitive dogs
--- ---
## **5\. Local Countryside Trails (Hidden Gems)** ## **5. Local Countryside Trails (Hidden Gems)**
Often overlooked, but some of the best options. Often overlooked, but some of the best options.
@@ -133,4 +124,3 @@ Its to do it in a way that:
Because the right environment makes all the difference. Because the right environment makes all the difference.
<!-- **Want help finding the right trails for your dog? Download TailTrails here.** --> <!-- **Want help finding the right trails for your dog? Download TailTrails here.** -->
@@ -1,13 +1,3 @@
---
title: "How to Choose the Right Walk for Your Dog (Based on Their Personality and Needs)"
date: 2025-04-20
description: "Not all walks are equal. Learn how to choose the right environment for your dog based on energy, temperament, and needs."
category: Strategy
readTime: "5 min"
live: true
---
### **Introduction** ### **Introduction**
Choosing a walk for your dog often comes down to convenience. Choosing a walk for your dog often comes down to convenience.
@@ -1,12 +1,3 @@
---
title: "How to Give a Reactive Dog a Fulfilling Life (Without Avoiding the World)"
date: 2025-03-15
description: "Have a reactive dog? Learn how to give them a fulfilling life with the right environments, structure, and approach."
category: Insights
readTime: "7 min"
live: true
---
### **Introduction** ### **Introduction**
Living with a reactive dog can feel limiting. Living with a reactive dog can feel limiting.
@@ -127,4 +118,3 @@ They just need the **right environments to thrive in**.
And when you give them that, everything starts to shift. And when you give them that, everything starts to shift.
<!-- **Want help finding the right trails for your dog? Download TailTrails here.** --> <!-- **Want help finding the right trails for your dog? Download TailTrails here.** -->
@@ -1,12 +1,3 @@
---
title: "Off-Leash Dog Rules in Portugal: What You Need to Know in 2026"
date: 2026-04-01
description: "Can you walk your dog off-leash in Portugal? Learn the rules, risks, and best practices for safe and legal off-leash walks."
category: Trends
readTime: "6 min"
live: true
---
### **Introduction** ### **Introduction**
Letting your dog off-leash is one of the simplest ways to give them freedom, enrichment, and a more natural experience. Letting your dog off-leash is one of the simplest ways to give them freedom, enrichment, and a more natural experience.
@@ -21,14 +12,14 @@ Heres what you need to know.
In general, dogs in Portugal are expected to be **under control at all times in public spaces**. In general, dogs in Portugal are expected to be **under control at all times in public spaces**.
That doesnt always mean physically on a leash \- but it *does* mean: That doesnt always mean physically on a leash - but it *does* mean:
* Your dog must respond reliably to commands * Your dog must respond reliably to commands
* They must not pose a risk to people, other animals, or property * They must not pose a risk to people, other animals, or property
* They must not cause disturbance * They must not cause disturbance
In many **urban areas**, leash use is effectively required. In many **urban areas**, leash use is effectively required.
In more **rural or remote areas**, off-leash walking is more commonly accepted \- but still comes with responsibility. In more **rural or remote areas**, off-leash walking is more commonly accepted - but still comes with responsibility.
--- ---
@@ -51,7 +42,7 @@ Youre more likely to safely and responsibly walk your dog off-leash in:
* Remote coastal routes (away from crowds) * Remote coastal routes (away from crowds)
* Open land where visibility is high * Open land where visibility is high
However, even in these areas, its not just about permission \- its about suitability for your dog. However, even in these areas, its not just about permission - its about suitability for your dog.
--- ---
@@ -75,7 +66,7 @@ Even if technically allowed, these environments can be:
### **The Risks Most Dog Owners Overlook** ### **The Risks Most Dog Owners Overlook**
Many owners assume off-leash \= freedom. Many owners assume off-leash = freedom.
But without the right environment, it can quickly become the opposite. But without the right environment, it can quickly become the opposite.
@@ -1,12 +1,3 @@
---
title: "The Importance of Variety in Your Dogs Life (And How to Do It Right)"
date: 2025-02-28
description: "Dogs need more than the same daily walk. Learn why variety matters and how to safely introduce new environments into your dogs routine."
category: Strategy
readTime: "5 min"
live: true
---
### **Introduction** ### **Introduction**
Most dogs live very predictable lives. Most dogs live very predictable lives.
@@ -80,26 +71,26 @@ Can actually:
## **How to Introduce Variety Properly** ## **How to Introduce Variety Properly**
### **1\. Start with similar environments** ### **1. Start with similar environments**
If your dog is used to quiet trails, try new *quiet* trails first. If your dog is used to quiet trails, try new *quiet* trails first.
--- ---
### **2\. Change one variable at a time** ### **2. Change one variable at a time**
* New location, same energy level * New location, same energy level
* New terrain, same level of stimulation * New terrain, same level of stimulation
--- ---
### **3\. Watch your dogs response** ### **3. Watch your dogs response**
Let their behaviour guide your decisions. Let their behaviour guide your decisions.
--- ---
### **4\. Build gradually** ### **4. Build gradually**
Confidence grows with positive experiences. Confidence grows with positive experiences.
@@ -122,4 +113,3 @@ They need **better, more varied experiences**.
Because when you get it right, even a simple walk can feel completely different. Because when you get it right, even a simple walk can feel completely different.
<!-- **Want help finding the right trails for your dog? Download TailTrails here.** --> <!-- **Want help finding the right trails for your dog? Download TailTrails here.** -->
@@ -0,0 +1,86 @@
### **Introduction**
If youre based in or visiting Lagos, youre surrounded by some of the most beautiful walking routes in Europe.
But not all hikes are equal - especially when youre walking with a dog.
Some are:
* Too exposed
* Too busy
* Too steep
* Or just not suited to your dogs needs
Here are 10 of the best dog-friendly hikes in the Algarve, plus what makes each one a good fit.
---
## **1. Ponta da Piedade Coastal Walk**
**Best for:** Calm, confident dogs
**Type:** Cliffside / scenic
Incredible views, but:
* Narrow in parts
* High foot traffic
Best early morning or off-season
---
## **2. Mata Nacional de Barão de São João**
**Best for:** Most dogs
**Type:** Forest / shaded
* Wide trails
* Plenty of shade
* Lower stimulation
---
## **3. Ria de Alvor Nature Reserve**
**Best for:** Low to moderate energy dogs
**Type:** Boardwalk / coastal
* Flat and accessible
* Can be busy
* Limited shade
---
## **How to Choose the Right One**
Instead of asking:
“Which hike is best?”
Ask:
“Which hike is right for my dog?”
Consider:
* Energy level
* Sociability
* Confidence
* Weather
* Time of day
---
## **Final Thoughts**
The Algarve is full of incredible places to explore with your dog.
But the best walks arent just beautiful.
Theyre the ones that:
* Suit your dog
* Feel comfortable
* And allow them to be at their best
<!-- **Want help finding the right trails for your dog? Download TailTrails here.** -->
@@ -0,0 +1,71 @@
### **Introduction**
The Algarve is one of the best places in Europe to explore with your dog.
Cliffside trails.
Quiet forests.
Open countryside.
But beneath all that beauty, there are a few **less obvious risks** that many dog owners (especially newcomers) dont see coming.
Knowing what to look out for can make the difference between a great walk and an emergency vet visit.
---
## **1. Pine Processionary Caterpillars (High Risk)**
These are one of the **most dangerous hazards** for dogs in Portugal.
They appear in:
* Pine forests
* Woodland trails
* Warmer months (typically late winter to spring)
### **Why theyre dangerous:**
Their tiny hairs contain a toxin that can cause:
* Severe swelling of the mouth and tongue
* Vomiting
* Difficulty breathing
* Tissue damage (in serious cases)
### **What to look for:**
* Caterpillars moving in a line (procession)
* Nests in pine trees (silk-like bundles)
---
## **2. Grass Seeds (Foxtails)**
Small, sharp, and incredibly problematic.
Theyre common in:
* Dry grasslands
* Trail edges
* Late spring and summer
### **Why theyre dangerous:**
They can lodge in:
* Noses
* Ears
* Eyes
* Between toes
---
## **Final Thoughts**
Walking your dog in the Algarve can be one of the best parts of living or visiting here.
But the best walks happen when you:
* Know what to look out for
* Choose environments intentionally
* Match the walk to your dogs needs
<!-- **Want help finding the right trails for your dog? Download TailTrails here.** -->
@@ -1,159 +0,0 @@
---
title: "Top 10 Hikes to do with your Dog in Lagos and the Algarve"
date: 2025-06-10
description: "Discover the best hikes in Lagos and the Algarve to take your dog on. From coastal trails to quiet forests, find the right walk for your dog."
category: Insights
readTime: "8 min"
live: true
---
### **Introduction**
If youre based in or visiting Lagos, youre surrounded by some of the most beautiful walking routes in Europe.
But not all hikes are equal \- especially when youre walking with a dog.
Some are:
* Too exposed
* Too busy
* Too steep
* Or just not suited to your dogs needs
Here are 10 of the best dog-friendly hikes in the Algarve, plus what makes each one a good fit.
---
## **1\. Ponta da Piedade Coastal Walk**
**Best for:** Calm, confident dogs
**Type:** Cliffside / scenic
Incredible views, but:
* Narrow in parts
* High foot traffic
Best early morning or off-season
---
## **2\. Mata Nacional de Barão de São João**
**Best for:** Most dogs
**Type:** Forest / shaded
* Wide trails
* Plenty of shade
* Lower stimulation
One of the most versatile options near Lagos
---
## **3\. Ria de Alvor Nature Reserve**
**Best for:** Low to moderate energy dogs
**Type:** Boardwalk / coastal
* Flat and accessible
* Can be busy
* Limited shade
---
## **4\. Rocha da Pena (near Loulé)**
**Best for:** High-energy, confident dogs
**Type:** Rocky / inland
* More challenging terrain
* Great for adventurous dogs
---
## **5\. Praia da Bordeira (West Coast)**
**Best for:** High-energy dogs
**Type:** Beach / open space
* Huge open areas
* Ideal for running
* Watch for wind \+ exposure
---
## **6\. Monchique Forest Trails**
**Best for:** Hot days / sensitive dogs
**Type:** Mountain / forest
* Cooler temperatures
* Shaded routes
* Varied terrain
---
## **7\. Lagos to Praia da Luz Walk**
**Best for:** Moderate energy dogs
**Type:** Coastal mix
* Combination of paths and views
* Can be busy in sections
---
## **8\. Parque Natural do Sudoeste Alentejano**
**Best for:** Dogs needing space
**Type:** Wild / remote
* Less crowded
* More natural terrain
---
## **9\. Seven Hanging Valleys Trail**
**Best for:** Experienced dogs only
**Type:** Cliffside
* Stunning but narrow
* Not suitable for reactive or unpredictable dogs
---
## **How to Choose the Right One**
Instead of asking:
“Which hike is best?”
Ask:
“Which hike is right for my dog?”
Consider:
* Energy level
* Sociability
* Confidence
* Weather
* Time of day
---
## **Final Thoughts**
The Algarve is full of incredible places to explore with your dog.
But the best walks arent just beautiful.
Theyre the ones that:
* Suit your dog
* Feel comfortable
* And allow them to be at their best
<!-- **Want help finding the right trails for your dog? Download TailTrails here.** -->
@@ -1,201 +0,0 @@
---
title: "Walking Your Dog in the Algarve: Hidden Dangers Every Owner Should Know"
date: 2025-07-05
description: "Walking your dog in the Algarve? Learn about hidden dangers like pine processionary caterpillars, grass seeds, heat, and more — plus how to keep your dog safe."
category: Tutorial
readTime: "7 min"
live: true
---
### **Introduction**
The Algarve is one of the best places in Europe to explore with your dog.
Cliffside trails.
Quiet forests.
Open countryside.
But beneath all that beauty, there are a few **less obvious risks** that many dog owners (especially newcomers) dont see coming.
Knowing what to look out for can make the difference between a great walk and an emergency vet visit.
---
## **1\. Pine Processionary Caterpillars (High Risk)**
These are one of the **most dangerous hazards** for dogs in Portugal.
They appear in:
* Pine forests
* Woodland trails
* Warmer months (typically late winter to spring)
### **Why theyre dangerous:**
Their tiny hairs contain a toxin that can cause:
* Severe swelling of the mouth and tongue
* Vomiting
* Difficulty breathing
* Tissue damage (in serious cases)
### **What to look for:**
* Caterpillars moving in a line (procession)
* Nests in pine trees (silk-like bundles)
### **What to do:**
* Avoid pine-heavy areas during peak season
* Keep your dog close in these environments
* If contact happens: **go to a vet immediately**
---
## **2\. Grass Seeds (Foxtails)**
Small, sharp, and incredibly problematic.
Theyre common in:
* Dry grasslands
* Trail edges
* Late spring and summer
### **Why theyre dangerous:**
They can lodge in:
* Noses
* Ears
* Eyes
* Between toes
And they dont come out easily—they move deeper into the body.
### **Signs to watch for:**
* Sneezing repeatedly
* Licking paws
* Head shaking
* Sudden discomfort
### **Prevention:**
* Avoid overgrown paths
* Check your dog after walks
* Pay close attention to paws and ears
---
## **3\. Heat and Sun Exposure**
The Algarve sun is intense, especially in summer.
Even when it doesnt feel extreme to you, it can be too much for your dog.
### **Risks:**
* Overheating
* Dehydration
* Burnt paw pads
### **Safer approach:**
* Walk early morning or late evening
* Choose shaded routes (forests \> exposed cliffs)
* Always carry water
* Test the ground temperature before walking
---
## **4\. Livestock and Wildlife**
Many rural trails pass through areas with:
* Wild cats
* Dog packs
* Goats
* Sheep
* Cattle
* Wildlife (including birds and small animals)
### **Why it matters:**
* Dogs with high prey drive may chase
* Farmers are protective of their animals
* Situations can escalate quickly
### **Best practice:**
* Keep your dog on-leash around animals
* Be aware of your surroundings
* Respect local land use
---
## **5\. Cliffs and Unstable Terrain**
The Algarve coastline is stunning, but not always forgiving.
### **Risks:**
* Loose rocks
* Narrow paths
* Sudden drops
### **Important:**
Even confident dogs can misjudge terrain.
### **Safer approach:**
* Avoid narrow cliff paths with reactive or excitable dogs
* Keep distance from edges
* Choose wider, more stable trails when possible
---
## **6\. High Dog Traffic Areas**
Some popular walking spots can be:
* Busy
* Unpredictable
* Overstimulating
This can be especially challenging for:
* Reactive dogs
* Nervous dogs
* Dogs in training
---
## **Why Environment Matters More Than You Think**
Most of these risks arent just about location.
Theyre about **fit**.
The same trail can be:
* Perfect for one dog
* Completely wrong for another
Thats why choosing where you walk isnt just about what looks good—its about what actually works for your dog.
---
## **Final Thoughts**
Walking your dog in the Algarve can be one of the best parts of living or visiting here.
But the best walks happen when you:
* Know what to look out for
* Choose environments intentionally
* Match the walk to your dogs needs
<!-- **Want help finding the right trails for your dog? Download TailTrails here.** -->
@@ -1,147 +0,0 @@
---
title: "Why “Dog-Friendly” Isnt Enough (And What Actually Matters)"
date: 2025-01-18
description: "“Dog-friendly” doesnt always mean suitable. Learn what really makes a walk right for your dog, and how to choose better environments."
category: Insights
readTime: "5 min"
live: true
---
### **Introduction**
“Dog-friendly” is everywhere.
Dog-friendly cafés.
Dog-friendly beaches.
Dog-friendly trails.
But heres the problem:
**Dog-friendly doesnt mean right for your dog.**
And relying on that label alone is one of the mistakes dog owners make.
---
### **The Problem with “Dog-Friendly”**
The term sounds helpful, but its incredibly broad.
A place can be dog-friendly and still be:
* Overcrowded
* Loud and overstimulating
* Too narrow or restrictive
* Unsafe for certain temperaments
* Physically unsuitable for your dog
It tells you one thing:
Dogs are allowed.
It tells you nothing about:
Whether your dog will actually enjoy being there.
---
### **Every Dog Experiences the World Differently**
This is where most advice falls short.
Dogs arent interchangeable.
Some are:
* Highly social and confident
* Sensitive to noise and movement
* Reactive around other dogs
* Driven by scent or prey
* Recovering from injury
* Low energy or ageing
The same environment can feel:
* Exciting for one dog
* Overwhelming for another
---
### **What Actually Makes a Walk “Good”**
A good walk isnt about distance or popularity.
Its about **fit**.
The right walk considers:
* **Dog traffic** busy vs quiet
* **Space** open vs narrow
* **Terrain** soft ground vs hard surfaces
* **Exposure** shaded vs direct sun
* **Environment** forest, beach, rural, urban
* **Stimulation level** predictable vs chaotic
When these align with your dogs needs, everything changes.
---
### **Signs Youre Choosing the Wrong Environments**
You might notice:
* Your dog becomes overstimulated or reactive
* They seem stressed or hyper-alert
* They pull, bark, or shut down
* Walks feel unpredictable or tense
Its not always a training issue.
Often, its an **environment mismatch**.
---
### **Why This Matters More Than Ever**
Modern dog ownership has shifted.
Dogs are:
* Living in more urban environments
* Exposed to more stimulation
* Expected to behave in unnatural settings
That means we need to be more intentional about:
Where we take them \- not just how often
---
### **A Better Way to Think About Walks**
Instead of asking:
“Is this place dog-friendly?”
Ask:
“Is this place right for my dog?”
That shift alone can:
* Reduce stress
* Improve behaviour
* Increase confidence
* Create better shared experiences
---
### **Final Thoughts**
Your dog doesnt need more places.
They need the **right places**.
Because when the environment fits, everything else gets easier.
<!-- **Want help finding the right trails for your dog? Download TailTrails here.** -->
+14
View File
@@ -0,0 +1,14 @@
// Generated list of filenames in the `public/blog-images` folder.
// If you add or remove images, update this list accordingly.
const BLOG_IMAGE_FILENAMES = [
'afra-ramio-cp2HCVzguw4-unsplash.jpg',
'dagmar-klauzova-afBc-k2luH4-unsplash.jpg',
'eric-ward-ISg37AI2A-s-unsplash.jpg',
'jamie-street-m4BkRRprvP0-unsplash.jpg',
'joe-caione-qO-PIF84Vxg-unsplash.jpg',
'rafaella-waasdorp-EkzMdwI_YE4-unsplash.jpg',
'tatum-bergen-Vt3odrTM4cQ-unsplash.jpg',
'troy-bridges-lbRNtUZPXXQ-unsplash.jpg',
];
export default BLOG_IMAGE_FILENAMES;
+77
View File
@@ -0,0 +1,77 @@
export type BlogMeta = {
title?: string;
date?: string;
description?: string;
category?: string;
readTime?: string;
live?: boolean;
};
const meta: Record<string, BlogMeta> = {
"best-off-leash-areas-for-dogs-in-lagos-and-nearby": {
title: "Best Off-Leash Areas for Dogs in Lagos (and Nearby)",
date: "2024-05-01",
description: "Looking for off-leash areas for dogs in Lagos, Portugal? Discover the best spots for safe, enjoyable off-leash walks, plus what to watch out for.",
category: "Insights",
readTime: "6 min",
live: true,
},
"how-to-choose-the-right-walk-for-your-dog-based-on-their-personality-and-needs": {
title: "How to Choose the Right Walk for Your Dog (Based on Their Personality and Needs)",
date: "2024-04-20",
description: "Not all walks are equal. Learn how to choose the right environment for your dog based on energy, temperament, and needs.",
category: "Strategy",
readTime: "5 min",
live: true,
},
"how-to-give-a-reactive-dog-a-fulfilling-life-without-avoiding-the-world": {
title: "How to Give a Reactive Dog a Fulfilling Life (Without Avoiding the World)",
date: "2024-03-15",
description: "Have a reactive dog? Learn how to give them a fulfilling life with the right environments, structure, and approach.",
category: "Insights",
readTime: "7 min",
live: true,
},
"off-leash-dog-rules-in-portugal-what-you-need-to-know-in-2026": {
title: "Off-Leash Dog Rules in Portugal: What You Need to Know in 2026",
date: "2026-04-01",
description: "Can you walk your dog off-leash in Portugal? Learn the rules, risks, and best practices for safe and legal off-leash walks.",
category: "Trends",
readTime: "6 min",
live: true,
},
"top-10-hikes-to-do-with-your-dog-in-lagos-and-the-algarve": {
title: "Top 10 Hikes to do with your Dog in Lagos and the Algarve",
date: "2024-06-10",
description: "Discover the best hikes in Lagos and the Algarve to take your dog on. From coastal trails to quiet forests, find the right walk for your dog.",
category: "Insights",
readTime: "8 min",
live: true,
},
"walking-your-dog-in-the-algarve-hidden-dangers-every-owner-should-know": {
title: "Walking Your Dog in the Algarve: Hidden Dangers Every Owner Should Know",
date: "2024-07-05",
description: "Walking your dog in the Algarve? Learn about hidden dangers like pine processionary caterpillars, grass seeds, heat, and more — plus how to keep your dog safe.",
category: "Tutorial",
readTime: "7 min",
live: true,
},
"the-importance-of-variety-in-your-dogs-life-and-how-to-do-it-right": {
title: "The Importance of Variety in Your Dogs Life (And How to Do It Right)",
date: "2024-02-28",
description: "Dogs need more than the same daily walk. Learn why variety matters and how to safely introduce new environments into your dogs routine.",
category: "Strategy",
readTime: "5 min",
live: true,
},
"why-dog-friendly-isn-t-enough-and-what-actually-matters": {
title: "Why “Dog-Friendly” Isnt Enough (And What Actually Matters)",
date: "2024-01-18",
description: "“Dog-friendly” doesnt always mean suitable. Learn what really makes a walk right for your dog, and how to choose better environments.",
category: "Insights",
readTime: "5 min",
live: true,
},
};
export default meta;
+46 -25
View File
@@ -9,6 +9,8 @@ export type BlogPost = {
live?: boolean; live?: boolean;
}; };
import meta from './blogMeta';
function slugify(name: string) { function slugify(name: string) {
return name return name
.toLowerCase() .toLowerCase()
@@ -41,33 +43,52 @@ function parseFrontmatter(raw: string) {
return { fm, content }; return { fm, content };
} }
// Import all markdown files from the assets raw-blogs folder as raw strings
const modules = import.meta.glob('../assets/raw-blogs/*.md', { eager: true, as: 'raw' }) as Record<string, string>;
const posts = Object.entries(modules).map(([path, raw]) => { let _postsCache: BlogPost[] | null = null;
const file = path.split('/').pop()!;
const slug = slugify(file);
const { fm, content } = parseFrontmatter(raw);
return {
slug,
title: fm.title ?? file.replace(/\.md$/, ''),
date: fm.date,
description: fm.description,
content,
category: fm.category,
readTime: fm.readTime,
live: typeof fm.live === 'boolean' ? fm.live : fm.live === 'true',
} as BlogPost;
}).sort((a, b) => {
const da = a.date ?? '';
const db = b.date ?? '';
return db.localeCompare(da);
});
export function getAllPosts(): BlogPost[] { async function loadPosts(): Promise<BlogPost[]> {
return posts; if (_postsCache) return _postsCache;
const slugs = Object.keys(meta);
const results: BlogPost[] = [];
for (const slug of slugs) {
try {
const url = `/raw-blogs/${slug}.md`;
const res = await fetch(url);
const raw = await res.text();
const { fm, content } = parseFrontmatter(raw);
const merged = { ...(meta[slug] || {}), ...fm } as Record<string, any>;
results.push({
slug,
title: merged.title ?? slug,
date: merged.date,
description: merged.description,
content,
category: merged.category,
readTime: merged.readTime,
live: typeof merged.live === 'boolean' ? merged.live : merged.live === 'true',
} as BlogPost);
} catch (e) {
// eslint-disable-next-line no-console
console.warn('Failed to load blog for slug:', slug, e);
}
}
results.sort((a, b) => {
const da = a.date ?? '';
const db = b.date ?? '';
return db.localeCompare(da);
});
_postsCache = results;
return results;
} }
export function getPostBySlug(slug: string): BlogPost | undefined { export async function getAllPosts(): Promise<BlogPost[]> {
return posts.find((p) => p.slug === slug); return await loadPosts();
}
export async function getPostBySlug(slug: string): Promise<BlogPost | undefined> {
const all = await loadPosts();
return all.find((p) => p.slug === slug);
} }
+10 -3
View File
@@ -1,5 +1,6 @@
import { clsx, type ClassValue } from "clsx"; import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge"; import { twMerge } from "tailwind-merge";
import BLOG_IMAGE_FILENAMES from './blogImages';
export function cn(...inputs: ClassValue[]) { export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs)); return twMerge(clsx(inputs));
@@ -16,9 +17,15 @@ export function getUnsplashImage(query: string, width = 1200, height = 675, seed
return `https://source.unsplash.com/${width}x${height}/?${q}${sig}`; return `https://source.unsplash.com/${width}x${height}/?${q}${sig}`;
} }
// Load local blog images (as URLs) from the assets folder. // Load local blog images (as URLs) from the public folder root.
const _blogImageModules = import.meta.glob('../assets/blog-images/*', { eager: true, as: 'url' }) as Record<string, string>; const _blogImageModules = import.meta.glob('/blog-images/*', { eager: true, query: '?url', import: 'default' }) as Record<string, string>;
const _blogImageUrls = Object.values(_blogImageModules); let _blogImageUrls = Object.values(_blogImageModules);
// Fallback: if the glob didn't return anything (public assets may not be importable),
// construct URLs from known filenames in the `public/blog-images` folder.
if (!_blogImageUrls || _blogImageUrls.length === 0) {
_blogImageUrls = BLOG_IMAGE_FILENAMES.map((n) => `/blog-images/${n}`);
}
/** /**
* Pick a local blog image by numeric index. Images are assigned in order. * Pick a local blog image by numeric index. Images are assigned in order.
+14 -11
View File
@@ -29,18 +29,21 @@ const BlogList = () => {
setLoading(true); setLoading(true);
setError(null); setError(null);
try { const load = async () => {
const all = getAllPosts(); try {
if (!active) return; const all = await getAllPosts();
// If frontmatter contains `live` flag, respect it; otherwise show all if (!active) return;
const filtered = isPreview ? all : (all as any).filter ? (all as any).filter((p: any) => p.live !== false) : all; const filtered = isPreview ? all : all.filter((p: any) => p.live !== false);
setPosts(filtered as BlogPost[]); setPosts(filtered as BlogPost[]);
} catch (err: any) { } catch (err: any) {
setError(err?.message || 'Failed to load posts.'); if (!active) return;
} finally { setError(err?.message || 'Failed to load posts.');
if (active) setLoading(false); } finally {
} if (active) setLoading(false);
}
};
void load();
return () => { return () => {
active = false; active = false;
}; };
+15 -7
View File
@@ -16,13 +16,21 @@ const BlogPost = () => {
useEffect(() => { useEffect(() => {
if (!slug) return; if (!slug) return;
const p = getPostBySlug(slug); let active = true;
setPost(p); const load = async () => {
if (p) { const p = await getPostBySlug(slug);
const posts = getAllPosts(); if (!active) return;
const idx = posts.findIndex((x) => x.slug === p.slug); setPost(p);
setIndex(idx >= 0 ? idx : undefined); if (p) {
} const posts = await getAllPosts();
const idx = posts.findIndex((x) => x.slug === p.slug);
setIndex(idx >= 0 ? idx : undefined);
}
};
void load();
return () => {
active = false;
};
}, [slug]); }, [slug]);
if (!post) { if (!post) {