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

Add resolutionHost option #3

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Add resolutionHost option #3

wants to merge 11 commits into from

Conversation

j6s
Copy link

@j6s j6s commented Apr 23, 2019

This is a PR for a fork that is not mine! (I didn't know that was possible either)

I just happened to stumble upon this fork containing 2 of the things that I wanted:

  1. An resolutionHost option that allows resolution based on the hostname
  2. A readme.md describing how the plugin works

With the resolutionHost option you can replace the complete hostname based on your content dimensions.
@MarcoPNS
Copy link
Contributor

MarcoPNS commented Jul 25, 2019

Hi @j6s ! Thanks for stumbling across my fork. to be honest it is not quite finished yet. You can not use the resolutionHost option in the uriPathSegment mode yet. Everything else already works.

@MarcoPNS
Copy link
Contributor

Just a small hint that this PR does not work for Neos 5.x yet - Need to wait till neos/neos-development-collection#2803 get accepted.

@MarcoPNS
Copy link
Contributor

Did some testing and the resolutionHost value now works with all modes but still need to wait for the other PR in the Neos Core.

@MarcoPNS
Copy link
Contributor

MarcoPNS commented Jan 5, 2021

Works with Neos 7 🎉 MarcoPNS@e5b05a7

@bwaidelich bwaidelich changed the title Add resoultionHost option Add resolutionHost option Jan 5, 2021
Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to the documentation need to be merged into the README.md that exists since #12

Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and please undo the permission changes on the PHP files, those do not need to be executable.

Comment on lines +7 to +8
"neos/neos": "~4.0||~5.0||~7.0||~8.0 || dev-master",
"neos/flow": "~5.0||~6.0||~7.0||~8.0 || dev-master"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"neos/neos": "~4.0||~5.0||~7.0||~8.0 || dev-master",
"neos/flow": "~5.0||~6.0||~7.0||~8.0 || dev-master"
"neos/neos": "^7.0 || ^8.0 || dev-master",
"neos/flow": "^7.0 || ^8.0 || dev-master"

@@ -482,6 +513,6 @@ protected function getRequestPathByNode(NodeInterface $node)
$currentNode = $currentNode->getParent();
}

return implode('/', array_reverse($requestPathSegments));
return '/' . implode('/', array_reverse($requestPathSegments));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@@ -422,6 +421,7 @@ protected function resolveRoutePathForNode(NodeInterface $node)
*
* @param NodeInterface $siteNode The site node, used as a starting point while traversing the tree
* @param string $relativeRequestPath The request path, relative to the site's root path
* @deprecated Use getNodeFromRequestPath() - return only the node
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@@ -409,8 +409,7 @@ protected function resolveRoutePathForNode(NodeInterface $node)
$nodeContextPathSuffix = ($workspaceName !== 'live') ? substr($nodeContextPath, strpos($nodeContextPath, '@')) : '';

$requestPath = $this->getRequestPathByNode($node);

return trim($requestPath, '/') . $nodeContextPathSuffix;
return $requestPath . $nodeContextPathSuffix;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Comment on lines -200 to +201
$relativeNodePath = $this->getRelativeNodePathByUriPathSegmentProperties($siteNode, $requestPathWithoutContext);
$node = ($relativeNodePath !== false) ? $siteNode->getNode($relativeNodePath) : null;
$node = $this->getNodeFromRequestPath($siteNode, $requestPathWithoutContext) ?? null;
Copy link
Member

@kdambekalns kdambekalns Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will conflict with #11 I think. Just pointing this out already…

@MarcoPNS
Copy link
Contributor

MarcoPNS commented Sep 8, 2023

@kdambekalns It's been sooo long. I can no longer answer exactly why. I would first have to work my way back into it.

@kdambekalns
Copy link
Member

I just looked at this again… @MarcoPNS if you still use this and have interest in it, I'd suggest we do this:

If you can't help, I suggest we close this. 🤷‍♂️

@kdambekalns kdambekalns self-assigned this Jul 2, 2024
@MarcoPNS
Copy link
Contributor

MarcoPNS commented Jul 4, 2024

Hi! There are cases where the options are not strict enough. I had projects where the domains looked like this:

Each domain leads to a separate dimension.

So the resolutionHost value was born to handle this type of case. The handling gets more complicated in case of multisites or if you want to mix the modes where you may have cases like this:

  • beispiel.de ('site-a')
  • sub.beispiel.de ('site-b')
  • example.com ('site-a')
  • sub.example.com ('site-b')
  • example.com/fr ('site-a')
  • sub.example.com/fr ('site-b')
  • sub.example.com/promo ('site-c')

As the feedback here was a bit limited, we started to develop an in-house solution for this and wrote a closed source package. If this is something that is also interesting here, I could implement it. This would get rid of the resolutionMode because it's not needed anymore. Config could look like this:

Neos:
  ContentRepository:
    contentDimensions:
      'language':
        label: 'Languages'
        icon: 'language'
        default: 'en'
        defaultPreset: 'en'
        uriSegmentHost: 'example.com'
        presets:
          'de':
            label: 'Deutsch'
            values: ['de']
            uriSegment: 'de'
            hosts:
              'site-a': 'beispiel.de'
              'site-b': 'sub.beispiel.de'
          'en':
            label: 'English'
            values: ['en']
            uriSegment: 'en'
            hosts:
              'site-a': 'example.com'
              'site-b': 'sub.example.com'
          'fr':
            label: 'France'
            values: ['fr']
            uriSegment: 'fr'
            hosts:
              'site-a': 'example.com/fr'
              'site-b': 'sub.example.com/fr'

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

Successfully merging this pull request may close these issues.

3 participants