Updating page.front

Created on 20 December 2024, 2 months ago

Problem/Motivation

As discovered in 📌 Front page always redirects to /home Active , if you set page.front directly in config, via drush or a recipe, the alias does not get stored as a system path and visiting the home page results in a 301 redirect to the alias. The validation to convert the alias to the system path runs in the form submit, so this does not happen if you make the change outside of the form.

Steps to reproduce

  1. Install Drupal
  2. Create a node with the alias '/home'
  3. Using drush, run drush config-set system.site page.front '/home'
  4. Visit home and see you are redirected to /home
  5. Visit the site settings form and save the form with no changes
  6. Visit home and see it no longer redirects

Proposed resolution

Per #3493615-8: Front page always redirects to /home : Core should have a config listener that resolves aliases to system paths (where they exist) instead of the logic happening in the form.

Remaining tasks

  1. Create an MR with tests
  2. Review
  3. Commit

User interface changes

None

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

None

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

system.module

Created by

🇦🇺Australia pameeela

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @pameeela
  • 🇦🇺Australia pameeela

    Oops, didn't finish writing the title.

  • 🇨🇭Switzerland berdir Switzerland

    Note: As commented in the Drupal CMS issue, there is the order of execution problem to consider. This is about a recipe setting config and I think also providing the default content. config is set first, so /home doesn't yet exist as an alias in that scenario and can't be resolved.

    Also note that config save event happens after config has already been saved in \Drupal\Core\Config\Config::save. I'm not aware of a use case where we alter config in that event, usually we just trigger something else. This would need to resave that config again. Not sure if that's really a good idea.

  • 🇦🇺Australia pameeela

    This issue directly conflicts with 🐛 Updating page.front Active which is trying to do away with this behaviour altogether. I'm going to close this since the other issue has much more activity, and we've got a workaround in Drupal CMS.

Production build 0.71.5 2024