Skip to main content

Overview

The BlogPost interface defines the structure for blog articles throughout the VENCOL application. It supports both static blog data and WordPress API integration, providing all necessary fields for displaying blog content, excerpts, and metadata.

Type Definition

Source: source/types.ts:8-17

Properties

number
required
Unique identifier for the blog post. Used for keys in React lists and database references.
string
required
The main headline of the blog post. Displayed in listings and on the detail page.
string
required
URL-friendly identifier used for routing (e.g., "que-es-la-mioglobina" becomes /blog/que-es-la-mioglobina).
string
required
Short summary or preview text of the blog post. Typically displayed in blog listing cards.
string
required
The full HTML content of the blog post. Can contain rich text, images, and formatting.
string
required
Publication date in human-readable format (e.g., "Oct 24, 2023" or "24 oct. 2023").
string
required
URL to the featured image for the blog post. Used as thumbnail in listings and hero image in detail view.
string
required
Category or tag for content organization (e.g., "Educativo", "Tecnología", "Medio Ambiente").

Usage Examples

Static Blog Posts

Defining blog posts directly in the application data:
Source: source/data/data.tsx:410-461

WordPress API Integration

Mapping WordPress API responses to the BlogPost interface:
Source: source/lib/wordpress.ts:33-80

Rendering Blog Cards

Using BlogPost data in components:
  • WPPage - Similar structure for static pages from WordPress
  • Service - Another content type with similar fields for solutions

Validation Notes

When integrating with WordPress API, ensure all HTML content in the content field is sanitized to prevent XSS vulnerabilities. The excerpt field should have HTML stripped for plain text display.

Date Formatting

The date field is stored as a formatted string rather than a Date object:
Source: source/lib/wordpress.ts:24-31

SEO Considerations

  • The slug should be URL-safe and descriptive for SEO
  • The excerpt is ideal for meta descriptions
  • The image URL should be optimized and include alt text in implementation
  • The title becomes the page title in detail views