Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is there a why to use Domain Source but not use it as a redirect?
For example I am publishing an article from Domain 1 but I am having it show up on all domains. I don't want the links to redirect back to the source domain but instead show the site name for the source domain on the article on all the sites.
Comments
Comment #1
agentrickardThe purpose of Domain Source is to provide control over the canonical URL of a node. DA does not use redirects, but rather rewrites the URLs to point to the canonical URL.
In your case, you likely need a different field to indicate the "source site name" of the node.
Comment #2
kim.le CreditAttribution: kim.le commentedSo there's nothing in the db for me to pull the "source site name" and I would need to create a custom field in my article content type? I'm trying to see if I can make this automatic so the user won't need to physically select the source domain (they like being lazy).
Comment #3
agentrickardRight, you'd need an extra field for it. Domain Source already has a specific use.
Comment #4
Alan D. CreditAttribution: Alan D. commentedCould be nice feature.
We just were informed that our client does not want to redirect when on one particular domain, rather to render the node without redirecting and to show the source domain and to provide a link to that domain to that content (yep, duplicated view of the same node). However, using the domain specific view modes / theming, these pages are different.
Comment #5
agentrickardHow would we abstract this to a feature that people could use?
Perhaps by adding an optional field -- using hook_field_extra_fields() -- that only applies to the Display options for Domain Source? That seems fairly easy to do.
Comment #6
Alan D. CreditAttribution: Alan D. commentedFirstly, maybe postpone until #1256368: Add 'visible' key to hook_field_extra_fields() gets in. This would allow you to set the default visibility to false.
As per the request, this would have just been a flag not to redirect, but a themable domain additional field would have been perfect. Views integration would be the logical next step.
A couple of hours after my post, our requirements changed (again...) and we have to add much more business logic to our "owner" field, namely expand it to allow a couple of the domains to specify specific owners from within that domain. So all domains are getting an Organisation node reference field, and each domain will have a default organisation assigned to it, and we'll do some custom theming to wrap this into the display of the "master" domain that shows content for all of these.
Comment #7
agentrickardYeah, thinking about this some more, disabling the rewrite feature of Domain Source seems the wrong way to accomplish this task.
More interesting, perhaps, is a generic Domain field that you could use for a variety of outputs, using field formatters.
Comment #8
Dave ReidGoing to mark this as a duplicate of #1684920: Add a 'domain' field type since there's a field type ready for review in that issue.