Sometimes (always?) it's helpful to be able to freelink to a URL alias as well as a title. Indeed, I think in a lot of cases this may be the default? In other words, I may want to have a page (maybe a view, or any sort of page, not necessarily a node) with a title "Foo Baa and some Harry" (or worse, no title at all), and I set up the url (alias) to be /FooBaa. Now I'd like the CamelCase link FooBaa to correctly point at the FooBaa URL.... Ok - ideally I'd love it to be replaced with the title correctly, if one is set (which is not always the case).... but, slowly grasshopper

The following patch is a half-way house. It ignores the (useful) ability to screen off some node types, and just looks up in the alias database..... you may consider doing a better job... but for now, it works for me.

It's patched against 5.x.1.0 (sorry).... But it's a small patch

Comments

markfoodyburton’s picture

StatusFileSize
new3.23 KB

Slightly improved patch

This will also make freelinking be more "generous" about what things it links too.

The "rule" is - if the title, or url alias contains the linked word, then it will match. The title or url that is the shortest will match first (in other words "FooBaa and stuff" will match FooBaa, and it will match before "FooBaa and stuff and more stuff".

Titles will always match before url's

markfoodyburton’s picture

StatusFileSize
new4.04 KB

Third time lucky. This includes a patch to the CamalCase handling code as discussed http://drupal.org/node/206711

It also fixes thngs so that the entire path is passed down to the right module to work out if we have a match in the url_alias.

Next up, between url_alias and freelinking, I want to put some ability to say
Foo/Baa/Harry should actually map onto /Foo/zoo/Baa/Harry
(Or arbitrary things like that)

markfoodyburton’s picture

Status: Active » Needs review

Should mark this as patch needing work

eafarris’s picture

Version: master » 5.x-1.3-beta1
Assigned: Unassigned » eafarris
Status: Needs review » Fixed

Committed an alternative fix for this as 5.x-1.3-beta1. This will require a bit of testing, but it seems to work here. As a test, I made a node titled "Apple, Inc." and used the path module to alias it to "apple". Subsequent freelinks to [[apple]] correctly brought me to the "Apple, Inc." node.

Please verify and close.

Thanks for the report.

markfoodyburton’s picture

Thanks for this.

I'm afraid I eventually worked out that I was asking for something sill (as per normal).

What I wanted was
[[/my/path/to/foo]]
To match.

But, actually, as I was using this from within pear - it was as easy to simply say to pear - if you see something with "/"s in, then it's probably a path, and just link to that directly. Hence I "short cut" around freelinker.

On the other issue though, still have a problem of freelinking being active inside html markup.... :-(
Did you manage to solve that too?

BTW, for what it's worth, having said all of that, your patch looks good :-)

Cheers

Mark.

Christefano-oldaccount’s picture

Status: Fixed » Needs review
StatusFileSize
new1.03 KB

I hate to reopen an issue once code has been committed, but the t() function on line 213 is missing a parenthesis and the module fails to install.

eafarris’s picture

Status: Needs review » Fixed

Grr. Thanks. Fixed in Beta 2.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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