jekyll-admin icon indicating copy to clipboard operation
jekyll-admin copied to clipboard

Support for layout metadata [enhancement request]

Open mariusa opened this issue 8 years ago • 14 comments

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!

mariusa avatar Jun 19 '17 12:06 mariusa

That's a nice suggestion @mariusa

ashmaroli avatar Jun 19 '17 13:06 ashmaroli

What about default front matters?

mertkahyaoglu avatar Jun 30 '17 08:06 mertkahyaoglu

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)

mariusa avatar Jul 03 '17 10:07 mariusa

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.

jekyllbot avatar Sep 03 '17 11:09 jekyllbot

huh?

mariusa avatar Nov 03 '17 12:11 mariusa

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.

melroy89 avatar Nov 19 '20 21:11 melroy89

@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.

ashmaroli avatar Nov 20 '20 10:11 ashmaroli

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.

melroy89 avatar Nov 20 '20 12:11 melroy89

@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.

ashmaroli avatar Nov 20 '20 13:11 ashmaroli

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

melroy89 avatar Nov 23 '20 22:11 melroy89

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.

ashmaroli avatar Nov 24 '20 08:11 ashmaroli

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

melroy89 avatar Nov 24 '20 11:11 melroy89

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/

ashmaroli avatar Nov 24 '20 12:11 ashmaroli

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

melroy89 avatar Nov 26 '20 01:11 melroy89