Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support frontmatter defaults in the front end #337

Merged
merged 9 commits into from
May 2, 2017
Merged

Conversation

mertkahyaoglu
Copy link
Member

Ability to view frontmatter defaults in the front end. Frontmatter defaults are inserted into metadata section of pages/documents' views to let users visually see all of the fields they have.

To achieve this, we read frontmatter defaults from the config file and inject them into metadata of pages and documents.

Fixes #165

@@ -113,6 +114,8 @@ export class DocumentEdit extends Component {
} = currentDocument;
const [directory, ...rest] = params.splat;

const metafields = injectDefaultFields(config, directory, collection, front_matter);
Copy link
Member

Choose a reason for hiding this comment

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

config is since recently,

{"content": {"foo": "bar"}, "raw_content": "foo: bar\n"}

So either this line and all instances of config passed to injectDefaultFields should be changed to config.content or change injectDefaultFields function to extract defaults from config.content

@mertkahyaoglu mertkahyaoglu changed the title [WIP] Support frontmatter defaults in the front end Support frontmatter defaults in the front end May 2, 2017
@mertkahyaoglu mertkahyaoglu merged commit 192e275 into master May 2, 2017
@mertkahyaoglu mertkahyaoglu deleted the defaults branch May 2, 2017 15:14
@ashmaroli
Copy link
Member

@mertkahyaoglu found a minor bug with this via server-frontend
If you were to access a page for editing, the browser console shows an momentary error due to a delay in fetching the config.content I'll open a dedicated ticket if you want..

@mertkahyaoglu
Copy link
Member Author

Thanks @ashmaroli 👍 . Recently I came across with this library from Facebook that will fix this kind of console errors very easily. I will try to integrate this when I get some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants