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

Automatic title and slug inconsistencies #6775

Open
nilshoerrmann opened this issue Oct 24, 2024 · 0 comments
Open

Automatic title and slug inconsistencies #6775

nilshoerrmann opened this issue Oct 24, 2024 · 0 comments

Comments

@nilshoerrmann
Copy link
Contributor

Description

When using the create option in a blueprint to customize the create dialog, it's possible to automatically set title and slug values on creation. This process has two unexpected flaws right now:

  1. While it's possible to use gobally defined page methods, it's not possible to access methods defined in the given page model.
  2. Both templates used to generate title and slug values get passed a virtual page with the content set for the new page. The title is generated first but as the slug receives the same virtual page, it does not know about the newly generated title. So it's not possible to generate a slug with the title content in mind which is problematic if the title contains a random component which cannot be replicated without knowing the title (think of any kind of random hash).

Expected behavior

  • Page methods and models should both work.
  • The slug template should also receive the newly created value of the title.

To reproduce

Simplified page blueprint:

title: Lizenz
create:
  title: '{{ page.licenseKey }}'
  slug: '{{ page.licenseSlug }}'
  fields:
    - plugin
    - email
  redirect: false
  status: listed

fields:
  email:
    type: email
  plugin:
    type: pages

The methods licenseKey and licenseSlug do work when defined in a page method.
They do not work if defined in the given page model.

Your setup

Kirby Version
Kirby 4.4.1

Additional context
It would be interesting to be able to set the slug generation to something like true to trigger automatic slug generation from the title. Currently an error is thrown, if no custom template is given. Setting {{ page.title }} does not work because the title is not set on the virtual page yet.

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

No branches or pull requests

1 participant