Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

feat: generate content title from frontmatter #51

Merged
merged 2 commits into from
Jan 21, 2020
Merged

Conversation

billyyyyy3320
Copy link
Member

Summary

Before:

---
date: 2019-2-26
tag: 
  - markdown
  - vuepress
author: ULIVZ
location: Hangzhou  
---

# Markdown Slot

VuePress implements a content distribution API for Markdown. With this feature, you can split your document into multiple fragments to facilitate flexible composition in the layout component.

## Why do I need Markdown Slot?

First, let's review the relationship between layout components and markdown files:

After:

---
title: Markdown Slot
date: 2019-2-26
tag: 
  - markdown
  - vuepress
author: ULIVZ
location: Hangzhou  
---

VuePress implements a content distribution API for Markdown. With this feature, you can split your document into multiple fragments to facilitate flexible composition in the layout component.

## Why do I need Markdown Slot?

First, let's review the relationship between layout components and markdown files:

There's no need to write your title in the beginning of your content any more, but that's not the main reason to make this breaking change.

In #32, we need a head which contains tags, date, author and location in post content.
In #45, we need a hero image for each post. It should be displayed in not only post list page but also post content page.

The ideal position for both of them is under the content title, but it'll be complicated to insert them into the middle of content.

I've checked out several blog tools and found that it's common to write title in front matter. I'll not merge this PR until I submit the PRs for #32 and #45. We can also remove modifyBlogPluginOptions in the next major release.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

@billyyyyy3320 billyyyyy3320 requested a review from ulivz January 14, 2020 16:12
@billyyyyy3320 billyyyyy3320 force-pushed the feat/title branch 2 times, most recently from 60e0342 to 929b5ee Compare January 15, 2020 11:59
@billyyyyy3320 billyyyyy3320 added the version:next Planned to do or already included in the next major version label Jan 17, 2020
Copy link

@bencodezen bencodezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the feature to add title from the frontmatter @newsbielt703! Just a couple of comments and then I think we should merge!

@@ -18,6 +35,11 @@ tags:
```

## date

- Type: `YYYY-MM-DD`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will timezones be accepted as well? Best to document the standard if we're using ISO-8601 or something else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VuePress' using gray-matter which depends js-yaml which follows standard yaml types, so all available formats are here. I've updated the docs.

@@ -31,6 +53,10 @@ date: 2016-10-20

## author

- Type: `string`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical to this PR, but what do you think about making Author an object instead so that people can define things like meta information (i.e., social media links, email, etc.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you recommend to leverage those meta information? Currently, people can display contact infos by the option footer.contact.

components/Toc.vue Show resolved Hide resolved
styles/palette.styl Show resolved Hide resolved
@billyyyyy3320 billyyyyy3320 deleted the feat/title branch January 29, 2020 09:11
@flozero
Copy link

flozero commented Jan 29, 2020 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
version:next Planned to do or already included in the next major version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants