Feature #53381

Allow the site node to contain content

Added by Bastian Waidelich over 1 year ago. Updated over 1 year ago.

Status:Resolved Start date:2013-11-06
Priority:Should have Due date:
Assigned To:Bastian Waidelich % Done:

100%

Category:Content Model
Target version:Base Distribution - 1.0 beta 2

Description

Neos has no notion of an initial landing page (e.g. homepage).
When accessing the root page ("http://www.yourdomain.tld/") you actually get a representation of the primary child node of the resolved site node.
The magic happens in the FrontendNodeRoutePartHandler:

1$node = ($relativeNodePath === '') ? $siteNode->getPrimaryChildNode() : $siteNode->getNode($relativeNodePath);

This is a problem for several reasons:

  • When linking to the homepage, f.e. using Fluid: node.uri(node: '~'), Neos will create an URI "/home.html"
  • The content of "/" is the same as "/home.html" which is bad SEO-wise
  • The homepage will be on the same level as other pages in the navigation tree which is wrong.

Associated revisions

Revision bdd72f43
Added by Bastian Waidelich over 1 year ago

[!!!][FEATURE] Allow the site node to contain content

This change adds the notion of "homepage" to Neos.
Previously, when accessing the homepage, Neos returned the primary
child of the site node leading to a couple of issues like:

  • Links to the homepage always resolve to "/home.html"
  • Duplicate content on "/" and "/home.html"
  • The "home" page is on the same level as it's sub pages in the
    navigation component

This change fixes this by allowing the site node to act just like
any other node, containing arbitrary child nodes.

This is a breaking change because it modifies the behavior of Neos:

  • The site node (marked with a globe icon in the backend) is now
    selectable in the navigation component
  • Navigation to the homepage will render the site node, no longer its
    first child node

For compatibility reasons the type of existing site nodes is changed
from ``unstructured`` to ``TYPO3.Neos:Shortcut`` when executing the
provided doctrine migration.
The same is true when importing existing ``Sites.xml`` exports via::

./flow site:import

This will, by default trigger an HTTP redirect to the first child
page in the site root.

You usually want to avoid this because it's not the best SEO-wise.
Currently the easiest way to achieve this, is to export the migrated
site with:

./flow site:export --tidy --filename "Some/Path/Sites.xml"

Then change the ``type`` attribute of the ``site`` node to
``TYPO3.Neos:Page`` and optionally move the old homepages child node
into the site node.
Afterwards you should be able to re-import the site.

Soon it'll be possible to change the node type via the Neos backend.

Change-Id: Iddc86edb51df20f1c72e280f8571b918a09af0f6
Resolves: #53381
Reviewed-on: https://review.typo3.org/25206
Reviewed-by: Bastian Waidelich
Tested-by: Bastian Waidelich
Reviewed-by: Christian Mueller
Tested-by: Christian Mueller
Reviewed-by: Aske Ertmann
Tested-by: Aske Ertmann

Revision c1b4cc5d
Added by Adrian Föder over 1 year ago

[TASK] Improve backward compatibility of Site Import

when attempting to import "old" Site XML, there is the need
to make the site node a Shortcut to the first subpage, flag it
to be hidden in index, and add a `title` property being the
site's name.

This introduces a method to "patch" the incoming XML to
comply with the above requirements.

Note: this reverts parts of Iddc86edb51df20f1c72e280f8571b918a09af0f6
where the backward compatibility requirements were already
partially implemented.

Change-Id: I3280096189f5f5eafa7b9c684d3d64c9376fe0f1
Resolves: #53609
Related: #53381
Reviewed-on: https://review.typo3.org/26071
Reviewed-by: Adrian Föder
Tested-by: Adrian Föder
Tested-by: Mr. Hudson
Reviewed-by: Karsten Dambekalns
Reviewed-by: Bastian Waidelich
Tested-by: Bastian Waidelich

History

#1 Updated by Bastian Waidelich over 1 year ago

As discussed with Sebastian, a clean way to solve this would allow the site node to be something else than unstructured. In fact it should be forced to be of type TYPO3.Neos:Document to make this explicit (TYPO3.Neos:Shortcut is also a sub-type of document btw)

These are the required steps for this to achieve:

  • Don't set the site as content object of the site node
  • Instead link it as property in the node (we'll need https://review.typo3.org/#/c/24738/ for this!)
  • Adjust code that expected the site node to be a proxy for site (shouldn't be many places)
  • Adjust TS objects (e.g. Breadcrumb needs to include the site node)
  • (possibly) adjust the navigation component, so that the root node is clickable
  • Adjust SiteImportService and SiteExportService
  • Adjust TYPO3.SiteKickstarter

#2 Updated by Bastian Waidelich over 1 year ago

A quick update re "Instead link it as property in the node (we'll need https://review.typo3.org/#/c/24738/ for this!)". Apparently we don't because properties get serialized transparently as of https://review.typo3.org/#/c/22826/
But I wonder if we need that bidirectional dependency Node <-> Site at all. It seems the site is never fetched from the node directly anywhere in the code. Only the site node is retrieved by the site's nodename property in ContentContext::getCurrentSiteNode()

It seems this change is less complex than I expected - but we do need to adjust some FlowQueryOperations that stop below the site node (e.g. parents())

#3 Updated by Bastian Waidelich over 1 year ago

  • Tracker changed from Bug to Feature
  • Subject changed from Missing notion of "homepage" to Allow the site node to contain content

#4 Updated by Gerrit Code Review over 1 year ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#5 Updated by Bastian Waidelich over 1 year ago

Current status (https://review.typo3.org/25206):

  • Don't set the site as content object of the site node
  • Instead link it as property in the node -> That wasn't required, we always fetch the site node from a site never the other way around
  • Adjust code that expected the site node to be a proxy for site -> there was none
  • Adjust TS objects -> Done for the Breadcrumb TS object
  • adjust the navigation component, so that the root node is clickable ->done, but it still needs some tweaking (see below)
  • Adjust SiteImportService and SiteExportService -> done
  • Adjust TYPO3.SiteKickstarter -> patch set in the working

Todos / Issues:

  • The inspector of the homepage shows all node properties, including "Name (URL)". Changing the name breaks the site because Site.nodeName is not a reference!
    It would be a good idea to change Site.nodeName to Site.rootNode, turning it into a proper relation. But that wouldn't solve the issue completely because it wouldn't make for an editor to change the site node name from the inspector anyways.
    A pragmatic solution would be to hide this editor for the homepage via JS - We'll have to touch that anyways soon for multi-language-support
  • We need a migration for existing sites turning the site node from unstructured to TYPO3.Neos:Shortcut (as discussed with Aske) and removing the site content object form it

#6 Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#7 Updated by Gerrit Code Review over 1 year ago

Patch set 3 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#8 Updated by Gerrit Code Review over 1 year ago

Patch set 4 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#9 Updated by Gerrit Code Review over 1 year ago

Patch set 5 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#10 Updated by Gerrit Code Review over 1 year ago

Patch set 6 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#11 Updated by Gerrit Code Review over 1 year ago

Patch set 7 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#12 Updated by Gerrit Code Review over 1 year ago

Patch set 8 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#13 Updated by Gerrit Code Review over 1 year ago

Patch set 9 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#14 Updated by Gerrit Code Review over 1 year ago

Patch set 10 for branch master of project Packages/TYPO3.Neos has been pushed to the review server.
It is available at https://review.typo3.org/25206

#15 Updated by Bastian Waidelich over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#16 Updated by Bastian Waidelich over 1 year ago

  • Target version set to 1.0 beta 2

Also available in: Atom PDF