Created
May 4, 2011 14:27
-
-
Save lsolesen/955307 to your computer and use it in GitHub Desktop.
How do you get the YAML frontmatter of a file?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = '--- | |
layout: default | |
title: Some title - yeah, right | |
--- | |
<h1>Tester</h1> | |
<p>Some content</p>'; | |
preg_match("'/---.*?---/s'", $content, $yaml_frontmatter); | |
print_r($yaml_frontmatter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment