DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsBlogGet Post by Slug
Introduction
Getting Started
Authentication
Products
Categories
Cart
Checkout
Blog
List PostsGet Post by Slug
Reviews
Webhooks
Customers
Orders
Inventory
Shipping
Discounts
Affiliates
Email
Media & Files
Analytics & Tracking
Locations
Tax
Global Data
SEO
Error Handling
Geography
Finance
Automations
Page Types
Surveys
Billing & Subscriptions
Storefront Payments
SDK Reference
REST API
Storefront Architecture
Notifications
Security
Team & Permissions
Migrations & Import
Calendar & Appointments
Contact Forms
AI Bots
Dashboard API
Deployment
Changelog
Troubleshooting
Recipes
CLI & Deployment
Image Pipeline
White-label Platforms
Records Engine
Platform Modules
Platform Security
Site Keys & Client Sites
Use Cases
Operations

Get Post by Slug

Fetch a single blog post with full content.

Updated March 29, 2026

On this page
  • Overview
  • SDK Usage
  • Post Object
  • Blog Post Page
  • Blog SEO
  • REST API
  • Next Steps

Overview

Fetch a single blog post with its full HTML content.

SDK Usage

typescript
import dash from "@/lib/dash"

const { post } = await dash.blog.get("my-first-post", {
  trackViews: "session",  // "session" | "always" | "none"
})

Post Object

json
{
  "id": "post_abc123",
  "title": "Introducing Our New Edibles Line",
  "slug": "introducing-new-edibles-line",
  "excerpt": "Discover our latest edibles collection...",
  "content": "<p>Full HTML blog post content here...</p>",
  "author": "CodeCraft Team",
  "category": { "id": "cat_blog1", "name": "News", "slug": "news" },
  "tags": ["edibles", "new-products", "announcement"],
  "featured_image": "https://cdn.dashfordevs.com/...",
  "is_featured": true,
  "published_at": "2025-01-15T10:00:00Z",
  "created_at": "2025-01-10T09:00:00Z",
  "custom_fields": {}
}

Blog Post Page

typescript
// app/blog/[slug]/page.tsx
import dash from "@/lib/dash"

export default async function BlogPost({ params }) {
  const { post } = await dash.blog.get(params.slug)

  return (
    <article className="max-w-3xl mx-auto py-12">
      <h1 className="text-3xl font-bold">{post.title}</h1>
      <div className="text-gray-400 mt-2">
        By {post.author} · {new Date(post.published_at).toLocaleDateString()}
      </div>
      {post.featured_image && (
        <img src={post.featured_image} alt={post.title} className="mt-6 rounded" />
      )}
      <div className="prose mt-8" dangerouslySetInnerHTML={{ __html: post.content }} />
    </article>
  )
}

// Generate SEO metadata
export async function generateMetadata({ params }) {
  const { seo } = await dash.blog.getSeo(params.slug)
  return {
    title: seo.title,
    description: seo.description,
    openGraph: { images: [seo.og_image] },
  }
}

Blog SEO

Fetch SEO metadata separately for Next.js generateMetadata:

typescript
const { seo } = await dash.blog.getSeo("my-first-post")
// seo = { title, description, keywords, og_image, canonical_slug }

See Blog SEO for details.

REST API

shell
GET /storefront/blog/posts/my-first-post
X-API-Key: pk_live_your_key

GET /storefront/seo/blog/my-first-post
X-API-Key: pk_live_your_key

Next Steps

  • List Posts — Blog listing with filters
  • Blog SEO — Meta tags for blog posts
  • Recipe: Build a Blog — Complete blog walkthrough
PreviousList PostsNextGet Product Reviews

On this page

  • Overview
  • SDK Usage
  • Post Object
  • Blog Post Page
  • Blog SEO
  • REST API
  • Next Steps