Comments

mordonez’s picture

StatusFileSize
new833 bytes

Here is a patch which fix the issue. I hope this is okay.

mordonez’s picture

Title: Duplicates prefixes (language) » LinkitPluginEntity needs buildPath with language support
Component: User interface » Code
Status: Active » Needs review

change status

yan’s picture

I'm experiencing a similar problem, but it seems to be different: Absolute links in my html text to my own website (like http://example.com/de/whatsoever) are changed to http://example.com/de/de/whatsoever when the setting "Correct URLs with Pathologic" is enabled. I thought this might be related because of this:

#1806678: Multilingual site, paths not prefixed with language

But the patch doesn't change anything.

anon’s picture

Title: LinkitPluginEntity needs buildPath with language support » LinkitSearchPluginEntity needs createPath with language support
Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Fixed

Fixed in 7.x-3.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

knalstaaf’s picture

Status: Closed (fixed) » Needs review

I'm using 7.x-3.x-dev and this issue is still occuring. Links are built like this: domain.com/nl//nl/my-page (remark the double slash between the prefix).

I'm using the following settings in the profile:

  • Profile type: fields
  • Search plugin: nodes (+ assigned some content types)
  • Insert methods: Raw url (alias paths)
  • Attributes: (default)
  • Autocomplete options: (default)
anon’s picture

What field type are you using?

The default for field should not be alias, as it will transform the link itself.

knalstaaf’s picture

I'm using a link-field, afaik there's no option there to output it as an alias.

anon’s picture

But you said that the profile you using has "Insert methods: Raw url (alias paths)".

knalstaaf’s picture

Status: Needs review » Closed (fixed)

Ow you mean the insert method; that was "Alias paths" indeed. I've changed it to "Raw paths".

It shows "node/46" in the edit page now, but when it's saved, it's output as a correct alias. Which is perfect.

Thanks!

anon’s picture

Version: 7.x-3.x-dev » 7.x-2.x-dev
Status: Closed (fixed) » Active

We need a similar solution for 7.x-2.x as we have in 7.x-3.x

anon’s picture

StatusFileSize
new981 bytes

Try this patch for 7.x-2.x

gurvan’s picture

the patch is not working for me, same configuration as above

anon’s picture

And by "not working" you mean dont apply or dont solve the issue?

gurvan’s picture

It don't solve the issue

peter törnstrand’s picture

Having the same problem. Patch in #12 does not solve the problem.

peter törnstrand’s picture

Sorry, disregard my last post. I'm using 2.x and applied the 3.x patch ... when applying the correct patch for 2.x it works.

Sneakyvv’s picture

StatusFileSize
new939 bytes

Shouldn't the language not be used at all?

This patch is for 7.x-2.x and adds an empty language so no prefix whatsoever is added.

Sneakyvv’s picture

StatusFileSize
new840 bytes

patch without parents paths

bart.hanssens’s picture

Status: Active » Needs review
Anonymous’s picture

Bumped into the same issue.
Patch #19 worked for me: thanks!

joelpittet’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Issue summary: View changes
StatusFileSize
new1 KB

Moving to 3.x - dev with patch.

Maybe a better solution would be a hook that this could be changed with OR only apply this when there is a fallback strategy in place?

joelpittet’s picture

StatusFileSize
new1.76 KB

Well that didn't work it needs to happen all the time or else the url() will use language_url global.

PascalAnimateur’s picture

Re-rolled patch without the comments.

This works in my case..

gaxze’s picture

Tried something else which worked on my site.

Status: Needs review » Needs work

The last submitted patch, 25: linkit-fix_language_prefix-1793896-25.patch, failed testing.

gaxze’s picture

StatusFileSize
new1.66 KB

Patch failed for some reason. Regenerated the patch.

gaxze’s picture

Status: Needs work » Needs review
PascalAnimateur’s picture

Will test the patch later today, but how about linking to content in a specific language, different than the current one? Would it be possible for the user to have the option of choosing the language prefix when creating the link?

gaxze’s picture

Gone a step further - fixed issue with wysiwyg editors. Found that there is a massive difference between how Drupal renders a link from a link field(using linkit) or from the wysiwyg(using linkit).

PascalAnimateur’s picture

Concerning my previous comment #29, I figured out pathologic was causing trouble by systematically replacing the language prefix (which prevented linking to other languages via the normal link widget in ckeditor) .. this is fixed with the patch from #2628348-4: Language prefix is not split off because of caching.

As for the proper way of addressing the language prefix issue in Linkit, I still think it would be useful to have the option of choosing the language when creating a link. Although with the patch from #30, which assumes the current language by default, translating a node would also translate all of its links automatically (storing /node/18 instead of /en/node/18 if I understand the patch correctly).

PascalAnimateur’s picture

Hmm.. concerning my last comment, the behavior I'm describing (auto-translating links inserted with linkit when translating a node) is only possible using pathologic with the patch I referenced above and by using my patch from #24 (which always removes the language prefix).

joelpittet’s picture

FYI @PascalAnimateur, I've been using #24 for quite some time without any real problem. The setup I have is entity_translation and en-CA/en-US path prefixes. Using /node/123 or /article/top-10-modules-for-content-editors instead of hard coded path prefixes means that the shared content in the body field between the two sites will have their links work in both sites. The reason is for both English is because of some legal wording from USDA around what products are allowed to say in technical terms. Though most of the site is the same copy for both sites. And pricing is different.

gaxze’s picture

StatusFileSize
new883 bytes

Found out that #30 add's '/' to all urls, external or internal.

gaxze’s picture

StatusFileSize
new2.34 KB

I should probably just combine these patches of patches..

gaxze’s picture

StatusFileSize
new2.67 KB

I'm having a long day. Uploaded an older patch(the original..). Take 7534853586856...

gaxze’s picture

StatusFileSize
new2.66 KB
Jeremy B’s picture

Do all links need to be re-saved once patch is applied ?

anon’s picture

Status: Needs review » Needs work

A test for this is needed.

nord102’s picture

I have modified #37 to not use alias' but instead use the internal path (e.g. "/node/123") for links. I have also added functionality that adds the language prefix when necessary.

nord102’s picture

Found that when linking to files, the prefix was already being included and therefore was adding twice. Added functionality to the patch in #40 to check whether or not the path being created contained the current language prefix before attempting to add it.

nord102’s picture

Modified the patch in #41 so that the functionality works as expected when the Linkit profile url_method is either using Raw paths or Raw paths, with a slash (/) in the beginning