Skip to content

Add automatic layout detection and title generation - #2

Open
ChristopherA wants to merge 1 commit into
mainfrom
feature/auto-frontmatter
Open

Add automatic layout detection and title generation#2
ChristopherA wants to merge 1 commit into
mainfrom
feature/auto-frontmatter

Conversation

@ChristopherA

Copy link
Copy Markdown
Owner

This PR adds automatic layout detection and title generation as core features of BaseTheme, reducing boilerplate in content files while maintaining flexibility.

Changes

  1. Added core plugins:

    • jekyll-titles-from-headings for automatic page title generation
    • jekyll-default-layout for automatic layout detection
  2. Added plugin configuration:

    titles_from_headings:
      strip_title: true      # Removes the first H1 from content
      strip_spans: true      # Removes span tags from titles
      collections: true      # Enables for collections
  3. Added _layouts/home.html template for index pages

  4. Updated README.md with new features and updated examples

  5. Updated documentation of layout hierarchy and front matter requirements

Automatic Layout Detection

Files will now automatically get the correct layout based on their location:

  • index.mdhome layout
  • _posts/*.mdpost layout
  • Other .md files → page layout
  • .html files → default layout

Automatic Title Generation

Page titles are now automatically generated from the first H1 heading in the content, removing the need to specify titles in front matter.

Breaking Changes

Users should update their _config.yml to include the new required plugins.

- Add jekyll-titles-from-headings and jekyll-default-layout as core plugins
- Add home layout template
- Configure automatic title generation with strip_spans
- Update documentation with new features

This change makes automatic layout detection and title generation core features of BaseTheme, reducing boilerplate in content files while maintaining flexibility.
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.

1 participant