Scully: Apply Settings From Markdown Frontmatter

Created on 16 Dec 2019  Â·  6Comments  Â·  Source: scullyio/scully

Markdown files have frontmatter that can declare variables, essentially, to use for the post. For example: canonical_url, published true/false flag, a date for when the post should be published, the permalink the post should be accessed at, page description for the head tag, etc.

When the blog posts are generated, the front matter should be examined and the fields there should be used for each post. This is functionality that is available in Jekyll, for example, and allows for tags to be created on posts and for authors to be specified, and for posts to be "scheduled".

Most helpful comment

Okay that's great, but I don't think this should be closed just yet. Some of those frontmatter items, like permalink or published or published date should be used. So if the filename is 2019-12-16-my-post.md, but the publish_date is 2019-12-20, the file should not be created until that day. In addition, if the permalink value is /this-is-the-post-name, that should be the generated file name, and not the actual file name.

Having some of the front matter available through the service is great, but those values also need to be used at build time. If that is set through the service, are there any examples of how to do this?

All 6 comments

image

Here is an example of frontmatter from a post on my site.

I think this front-matter plugin could work perfectly. You use it to parse a markdown file, and it returns an object like this:

{
    attributes: {
        title: 'Just hack\'n',
        description: 'Nothing to see here'
    },
    body: '\nThis is some text about some stuff that happened sometime ago',
    frontmatter: 'title: Just hack\'n\ndescription: Nothing to see here'
}

The attributes could then be applied to the document.

Another option could be using this yaml-front-matter plugin. It's similar to the above, but it just returns the frontmatter as an object. Then the permalink for the post could be determined, the page title, and other similar things.

Front-matter is already in use, and all the data is available to you angular app by means of the ScullyRouteService

Okay that's great, but I don't think this should be closed just yet. Some of those frontmatter items, like permalink or published or published date should be used. So if the filename is 2019-12-16-my-post.md, but the publish_date is 2019-12-20, the file should not be created until that day. In addition, if the permalink value is /this-is-the-post-name, that should be the generated file name, and not the actual file name.

Having some of the front matter available through the service is great, but those values also need to be used at build time. If that is set through the service, are there any examples of how to do this?

Sorry, I didn't want to be rude. All of this is already planned. A couple
of those things will land before beta, and a couple of others right after.
That is the reason I closed the issue.

Op di 17 dec. 2019 om 06:02 schreef Preston Lamb notifications@github.com:

Okay that's great, but I don't think this should be closed just yet. Some
of those frontmatter items, like permalink or published or published date
should be used. So if the filename is 2019-12-16-my-post.md, but the
publish_date is 2019-12-20, the file should not be created until that
day. In addition, if the permalink value is /this-is-the-post-name, that
should be the generated file name, and not the actual file name.

Having some of the front matter available through the service is great,
but those values also need to be used at build time. If that is set through
the service, are there any examples of how to do this?

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/scullyio/scully/issues/34?email_source=notifications&email_token=AAJQ6O2ZSDQMBHJWNJWU4RDQZBMO7A5CNFSM4J3TBJ62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHBEZ6Q#issuecomment-566381818,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAJQ6O7Y6DLOXD5VYLQ3MHTQZBMO7ANCNFSM4J3TBJ6Q
.

Okay sounds great. :) Thanks for the explanation! Looking forward to those things. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beeman picture beeman  Â·  3Comments

jorgeucano picture jorgeucano  Â·  4Comments

msprogramando picture msprogramando  Â·  5Comments

jorgeucano picture jorgeucano  Â·  4Comments

spencerb02 picture spencerb02  Â·  5Comments