DEV Community

ishaan-00
ishaan-00

Posted on

Test Post with Advanced YAML

Test Post with Advanced YAML

Ever wondered how your favorite Dev.to posts get those slick cross-posting links, episode numbers, and series labels? It turns out, a lot of that magic happens before the Markdown even begins — in the YAML front matter. Today, let's crack open the extended YAML structure powering multi-platform publishing, series organization, and more. If you've ever wanted your posts to play nicely with advanced workflows or just look extra polished, this is for you.

Why Extended YAML Matters

YAML (Yet Another Markup Language) is more than a place for your post's title. With a thoughtfully structured YAML block, you can:

  • Keep content organized across a series.
  • Automate cross-posting and canonical links.
  • Add custom metadata for episode numbering, tags, and more.

This isn't just for Dev.to — platforms like Hashnode, Medium, and your own blog can use this metadata to sync posts, boost discoverability, and make content management easier.

Deep Dive: The Essential YAML Fields

Let's break down the most useful fields you'll see in an extended YAML front matter. If you're new to YAML, think of it as a set of key-value pairs at the top of your Markdown file. Here's what each field does:

Title and Description

These are your bread-and-butter:

  • title: The headline. What readers see at the top.
  • description: A brief summary — often used for SEO, previews, and social cards.

Example:

title: "Test Post with Advanced YAML"
description: "An in-depth look at using extended YAML front matter for developer content."
Enter fullscreen mode Exit fullscreen mode

Series Metadata

If you're writing a multi-part tutorial or ongoing blog series, these fields keep everything in order:

  • series: The overarching name of your series (e.g., "Advanced Markdown Tricks").
  • episode_number: The numeric position in the series (e.g., 3).
  • roman: Roman numeral version (III). Useful for stylized labels.
  • part: Slug or identifier for this part (part-one, part-two).
  • part_label: Human-readable label (Part One, Part Two).

These fields help readers — and automation scripts — see how your content fits into the bigger picture.

Example:

series: "Advanced Markdown Tricks"
episode_number: 3
roman: III
part: part-three
part_label: "Part Three"
Enter fullscreen mode Exit fullscreen mode

Tagging

  • tag: The primary tag (e.g., markdown, yaml, tutorial). Used for categorization and search.

Tags make your content more discoverable and help readers find related posts.

Cross-Posting Metadata

If you're publishing on multiple platforms, these fields help track and link your posts:

  • canonical_url: The original source — crucial for SEO to avoid duplicate content penalties.
  • devto_id, hashnode_id: Unique IDs for your posts on Dev.to or Hashnode.
  • devto_url, hashnode_url: Direct URLs for your cross-posted versions.

Example:

canonical_url: "https://yourblog.com/posts/advanced-yaml"
devto_id: 123456
devto_url: "https://dev.to/yourusername/advanced-yaml"
hashnode_id: "abc123"
hashnode_url: "https://hashnode.com/post/advanced-yaml"
Enter fullscreen mode Exit fullscreen mode

Having these fields lets you automate backlinking, share canonical sources, and keep your publishing pipeline tidy.

Publication Date

  • date: When the post went live. Format: YYYY-MM-DD.

This helps with sorting, scheduling, and version control.

Putting It Together: Sample YAML Front Matter

Here’s what a complete YAML block might look like at the top of your Markdown file:

title: "Test Post with Advanced YAML"
series: "Advanced Markdown Tricks"
episode_number: 3
roman: III
part: part-three
part_label: "Part Three"
tag: markdown
description: "An in-depth look at using extended YAML front matter for developer content."
date: 2024-06-15
canonical_url: "https://yourblog.com/posts/advanced-yaml"
devto_id: 123456
devto_url: "https://dev.to/yourusername/advanced-yaml"
hashnode_id: "abc123"
hashnode_url: "https://hashnode.com/post/advanced-yaml"
Enter fullscreen mode Exit fullscreen mode

Most platforms will ignore unknown fields, so you can safely include all of these even if you only use a subset.

Markdown Content: Lists and Code Blocks

Once your YAML is set, it’s time for the content itself. Markdown is flexible enough to handle lists, code, images, and more. Here’s how you might illustrate some basics.

Lists

Lists help break down concepts, steps, or options:

  • First item
  • Second item
    • Nested item

To create a nested item, just add two spaces before the dash.

Code Block

When you want to show code, use triple backticks. Specify the language for syntax highlighting:

console.log("Hello, test post!");
Enter fullscreen mode Exit fullscreen mode

If you ever need to display YAML itself:

series: "Advanced Markdown Tricks"
episode_number: 3
Enter fullscreen mode Exit fullscreen mode

Using Extended YAML for Automation

One of the best reasons to adopt this structure is automation. Whether you’re running a static site generator like Jekyll or Hugo, or building your own scripts, you can:

  • Pull series metadata to build dynamic indexes or navigation.
  • Sync cross-posted content and update links automatically.
  • Generate episode lists with Roman numerals and custom part labels.

For example, a script could read your series, episode_number, and devto_url fields to build a table of contents for your series across multiple platforms. Or, you might use the canonical_url to set the <link rel="canonical"> tag in your HTML template.

Tips for Managing Your YAML

YAML is sensitive to whitespace, so:

  • Use spaces, not tabs.
  • Keep indentation consistent.
  • Put strings in quotes if they contain special characters.

If you’re working with multiple posts, consider creating a template YAML block to copy-paste for new entries.

Conclusion: Take Your Markdown Further

If you’re just starting out, basic YAML is fine. But as your blog or project grows, extended YAML front matter unlocks new levels of organization, automation, and cross-platform publishing. You’ll spend less time copying links, managing episode numbers, and fixing duplicate content — and more time creating.

Try adding a few of these fields to your next post. Even if your platform ignores them for now, your future self (or your automation scripts) will thank you. Happy writing — and happy automating!


Got questions about YAML front matter or want to share your own workflow tricks? Drop a comment below!

Top comments (0)