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 for layout metadata [enhancement request] #399

Open
mariusa opened this issue Jun 19, 2017 · 14 comments
Open

Support for layout metadata [enhancement request] #399

mariusa opened this issue Jun 19, 2017 · 14 comments
Labels

Comments

@mariusa
Copy link

mariusa commented Jun 19, 2017

layout is almost required for every page/post, but still needs to be added manually with JekyllAdmin

Instead, layout should be present as a dedicated field for all pages/posts, similar to Title, with a select drop-down to choose from:
default
[list all other layouts present in site]
none

Thanks!

@ashmaroli
Copy link
Member

That's a nice suggestion @mariusa

@mertkahyaoglu
Copy link
Member

What about default front matters?

@mariusa
Copy link
Author

mariusa commented Jul 3, 2017

When creating a new page, the pre-selected value in the layout dropdown should match the default set in _config.yml

Ideally, but this is another issue, if there's a default set and the chosen layout matches the default, the page shouldn't have the layout property at all (since the default is used)

@jekyllbot
Copy link

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

@mariusa
Copy link
Author

mariusa commented Nov 3, 2017

huh?

@melroy89
Copy link

I agree. This must be solved!

If I create want to create a new post, by pressing on the "New Post" button. I should by default add the layout meta data with the value post.

@ashmaroli
Copy link
Member

@Danger89 The recent versions of Jekyll Admin renders a dropdown that allows selection through layouts available in the site.
Besides, since Jekyll core doesn't enforce the condition that layout: post is meant for posts and posts alone, I don't see the need to auto-populate the layout metadata field.

@melroy89
Copy link

Well without layout defined, using the default theme. It won't render the site correctly. For people with less knowledge (assuming they are using this admin panel).

This is not user friendly whatsoever. Also the knowledge of the post tag is not available for those users.

@ashmaroli
Copy link
Member

@Danger89 Perhaps I'm not understanding your concern enough.
Please walk with me via following steps and let me know where you (assumed to be a novice user) get stuck..:

  • create new site by running jekyll new admin-site --skip-bundle on a terminal window.
  • Add gem "jekyll-admin", "~> 0.10" under group :jekyll_plugins in the Gemfile.
  • On the terminal window, run cd admin-site && bundle install
  • Run dev server by executing bundle exec jekyll serve
  • Navigate to http://localhost:4000/admin/ in browser
  • Click Posts in the sidebar.
  • Click New Post in the content window.
  • Scroll down >> Click on New metadata field >> enter layout in the input field and click elsewhere.
  • Notice a dropdown rendered next to the input field.

@melroy89
Copy link

melroy89 commented Nov 23, 2020

Sure; I will explain it in more detail. I'm using Jekyll as a Wordpress alternative for a site that get managed by inexperienced user, with minimal to no knowledge about Jekyll or markdown files. The person can create articles in Wordpress without issues.

When using Jekyll-admin the user need to know about the fact they need to enter the layout field manually with post as a value (which is not general knowledge to expect from inexperienced users). Otherwise the page is broken (with the default theme).

It's important to understand for what people you are creating Jekyll-admin. I expect most end-users would not be very experienced with Jekyll and/or markdown, otherwise I expect the users to edit the markdown files directly.

Meaning the following steps should become obsolete once the user pressed the New Post button:

Scroll down >> Click on New metadata field >> enter layout in the input field and click elsewhere.
Notice a dropdown rendered next to the input field.

And be replaced by:

  • By default the layout is 'post', and people can use the dropdown menu to select another layout if they want.

After all, the button is called 'New Post'.

Thanks! Let me know what your plans are. 👍🏽

Regards,
Melroy van den Berg

@ashmaroli
Copy link
Member

It's important to understand for what people you are creating Jekyll-admin. I expect most end-users would not be very experienced with Jekyll and/or markdown, otherwise I expect the users to edit the markdown files directly.

While the maintainers of this plugin does consider the very beginner Jekyll-user as part of the target demographic, this plugin cannot be considered an alternative to the more powerful / flexible Wordpress CMS.
We expect the users to have basic knowledge about the authoring aspects of Jekyll.

Meaning the following steps should become obsolete once the user pressed the New Post button...

I see. Since Jekyll will issue a warning (in the terminal console) for layouts that do not exist, setting a layout automatically could result in warnings that will confuse the novice user. So in theory, what we can do is have the layout: post set automatically if that layout exists.

What you can do to help your novice client is set front matter defaults in their config file. However, they'll get warning messages if they switch to a theme with a layout named post.

@melroy89
Copy link

Ow so there is already a way to set a default in the configs some how?

@ashmaroli
Copy link
Member

Note: The said defaults are for Jekyll, not specific to Jekyll Admin.

defaults:
- scope:
    path: ''
    type: posts
  values:
    layout: post
- scope:
    path: ''
    type: pages
  values:
    layout: page

More info at https://jekyllrb.com/docs/configuration/front-matter-defaults/

@melroy89
Copy link

This is great. I think this is a good "workaround" to get default values in jekyll-admin. Thanks works as expected 👍🏽 !

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

No branches or pull requests

5 participants