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

Import site metadata into admin interface #543

Merged
merged 6 commits into from
Mar 1, 2020

Conversation

ashmaroli
Copy link
Member

To allow selecting existing categories, layouts and tags via the interface.

The idea is to fetch the data related to above every time a page / draft / document is created / edited so that the Metafields component always reflects the latest status (i.e. a category added to one post will be available for the next post being edited).

Current;y, this is just Phase I of supporting categories and tags via the interface.
Phase II will involve Metafields utilizing the imported site meta.

@ashmaroli ashmaroli marked this pull request as ready for review December 2, 2019 06:51
Copy link
Member

@mertkahyaoglu mertkahyaoglu left a comment

Choose a reason for hiding this comment

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

I think we can fetch site meta once in App.js and use it in other places.
In this implementation, I saw fetchSitemeta is destructed in several places but not used. What was the reason for that?

@ashmaroli
Copy link
Member Author

I think we can fetch site meta once in App.js and use it in other places.

Fetching just once is not enough.

The reason we need to continuously fetch is because the data exposed at this endpoint (categories and tags) can change per page / document and affect the entire site
i.e. when site.tags (at backend) is initially {}, saving a metafield tags with value ["foo", "bar"] at /admin/collections/posts/2019-12-03-hello.md will cause the backend object site.tags to be populated with those keys.
The user would then expect to be suggested to use "foo" as they start to type "fo" in the tags metafield at location /admin/collections/posts/2019-12-03-hello-again.md. For that the frontend state.meta.site.tags should've already updated in sync with the backend.

Similarly, a layout created outside the admin interface (with the interface already loaded in the browser) should be reflected in the metafield data once the user mounts an *Edit or *New components.

destructed in several places but not used

🤦 I guess I missed it when I was adding changes to git index. All those places will contain a call to fetchSiteMeta()

@ashmaroli
Copy link
Member Author

I think I can centralize the fetchMeta() calls and yet update metadata as required by having it be called inside the Metafields container...

@ashmaroli ashmaroli merged commit ea81df9 into jekyll:master Mar 1, 2020
@ashmaroli ashmaroli deleted the fetch-site-meta branch March 1, 2020 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants