Problem/Motivation
The module has an endpoint that serves the front page, and which node that is comes from its own setting — special_page_nodes.frontpage. The normalizer, however, decides whether the thing it is describing is the front page by comparing the alias against system.site.page.front, which is Drupal's setting for its own HTML site.
On a decoupled site those are two different questions with two different answers. Drupal's front page is whatever the site was installed with and nobody has any reason to change it, because nobody browses Drupal. The front end's front page is the node the module was told about. When they disagree, the front-page endpoint answers with the alias of the node instead of /:
"locales": { "current_language": "en", "current_locale": "/bench-page", "en": "/bench-page" }, "metatags": { "canonical": "/bench-page", "og_url": "/bench-page", "alternate": [ {"hreflang": "x-default", "href": "https://example.com/bench-page"} ] }
A front end that puts that in <link rel="canonical"> tells search engines the home page lives at two addresses.
Steps to reproduce
- Name a node in
special_page_nodes.frontpage, and leavesystem.site.page.frontat whatever the installer set. - Request the front-page endpoint.
locales.current_locale,metatags.canonical,metatags.og_urland everyalternatehref carry the alias of the node rather than/.
Proposed resolution
- Collect the front pages from the node named by
special_page_nodes.frontpage, per language, and keep readingsystem.site.page.frontas well: a site that has aligned the two must keep working, and a site that serves both a Drupal front page and a decoupled one has two right answers. - Cover it: the endpoint answers
/for the node it was told about, whether or not Drupal names the same one, and a site that names neither is unchanged.
Remaining tasks
Everything.
Issue fork myrest-3623211
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
sergeydruua commentedComment #6
sergeydruua commented