Skip to content

Instantly share code, notes, and snippets.

@johannessteu
Last active December 18, 2015 22:30
Show Gist options
  • Save johannessteu/d8ab09f94bb68f0f89ab to your computer and use it in GitHub Desktop.
Save johannessteu/d8ab09f94bb68f0f89ab to your computer and use it in GitHub Desktop.
Neos Plugin Routes.yaml
prototype(Vendor.Name:FooPlugin) < prototype(TYPO3.Neos:Plugin)
prototype(Vendor.Name:FooPlugin) {
package = 'Vendor.Name'
controller = 'Standard'
action = 'index'
}
#
# Put this in your global Routes.yaml
# !!! This must be included before the TYPO3 Neos-Routes
#
-
name: 'Foo routes'
uriPattern: '<VendorNameFooRoutes>'
defaults:
'@package': 'Vendor.Name'
'@format' : 'html'
subRoutes:
VendorNameFooRoutes:
package: Vendor.Name
#
# Put this in your packages Routes.yaml
#
-
name: 'Basic Route'
uriPattern: '{node}/custom-part/{--vendor_name-fooplugin.object}.{@format}'
defaults:
'@package': 'TYPO3.Neos'
'@controller': 'Frontend\Node'
'@format': 'html'
'@action': 'show'
'--vendor_name-fooplugin':
'@package': 'Vendor.Name'
'@controller': 'Standard'
'@action': 'index'
'@format': 'html'
routeParts:
node:
handler: TYPO3\Neos\Routing\FrontendNodeRoutePartHandler
'--vendor_name-fooplugin.object':
objectType: '\Vendor\Name\Domain\Model\Object'
uriPattern: '{name}'
appendExceedingArguments: TRUE
URL:
http://example.com/nodename.html?
--vendor_name-fooplugin[package]=vendor.name&
--vendor_name-fooplugin[controller]=standard&
--vendor_name-fooplugin[action]=index&
--vendor_name-fooplugin[object][__identity]=4de2cc9c-79c0-55e7-310e-91c5ae2fea19
should result in
http://example.com/nodename/custom-part/objectname.html
while objectname is dynamic
@Benjamin-K
Copy link

Dear Johannes Steu,

could you please explain how to set an alternative route for an existing page/node?
For example i have this Page-Structure:

  • Home
    • Products
      • Productgroup 1
        • Productsubgroup 1
          • Product 1-1
          • Product 1-2
        • Productsubgroup 2
          • Product 2-1
          • and so on
    • Some other pages

And i want to access Product 1-1 just like http://host.com/productgroup-1/product-1-1.
Could you please explain how to set this up?

Blessings

Benjamin Klix

@johannessteu
Copy link
Author

Hi Benjamin,

my gist is about a Routes.yaml for a plugin/pluginview. I don't think you can exclude some nodes from your tree in the url at the moment like you can do in e.g. in realurl on TYPO3 CMS. You could probably send in a feature request at https://jira.typo3.org

Johannes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment