Closed (outdated)
Project:
AddToAny Share Buttons
Version:
6.x-3.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Jan 2011 at 14:09 UTC
Updated:
18 Mar 2016 at 23:02 UTC
Jump to comment: Most recent
Comments
Comment #1
micropat commentedGreat feature request. The module easily supports custom domains hosted by bit.ly or awe.sm and also custom short URLs via AddToAny's JavaScript API; however, it would be tricky to get custom short URLs to work with the current module version.
For reference:
http://www.addtoany.com/buttons/customize/link_tracking
To demonstrate a non-working example, you'd specify the following in the AddToAny settings panel > Additional options > Additional script:
Problem is, http://example.com/abc123 needs to be a variable for each short URL.
Also note that one important aspect about using AddToAny's config above is that AddToAny will only enable shortening for services where short URLs are appropriate. For instance, Twitter & Facebook, but not Digg or Google Bookmarks. So I'd advise against replacing $link_url.
Essentially, the settings panel's Additional script box would need to support some kind of 'template variables' or token.
Token module: I'd usually say let's veto a dependency, but it appears that the Token module made it upstream to Drupal 7, so I don't mind using it if it's standard use, efficient, and makes sense.
Any thoughts on a patch or best practices for this kind of thing?
Comment #2
ao2 commentedSo if I get it right, the url in
a2a_config.track_links_keywill be used only when needed by the given service?Btw, enabling tokens in the Additional script field is not too hard:
This allows us, to have somenthing like the following properly replaced:
If that looks right I can send a proper git am friendly patch.
Thanks,
Antonio
Comment #3
ressaIs it possible to use the original Drupal URLs, like example.com/node/1027978, and would it be hard to set up?
Comment #4
izmeez commented+1 to the question in Comment #3, how to configure addtoany to use a short Drupal url, http://example.com/node/12345
Comment #5
ao2 commentedwith the patch above you just use
a2a_config.track_links_key = '[site-url]/node/[nid]';in the last snippet.Please report if that works for you.
Thanks,
Antonio
Comment #6
IWasBornToWin commentedI just downloaded version 7. Do I need to go somewhere in the module code in order to use a custom url?
Comment #7
enginpost commentedI am working with Drupal 8, but I think this could work for Drupal 7 too. This worked for me...
I added the contrib metatag module and set the shortlink URL metatag in the Advanced section to the path: [site:url]/node/[node:nid]
That got the short(ish) node number URL on the page for me with the right dynamic tokens.
With the AddToAny module loaded, I added the following additional javascript in the "AddToAny" configuration settings "additional options" area:
This should assign the basic Drupal node number url as the path. If you want to redirect that back to a nicer pathauto clean url alias that exists for the node, then ready my blog post about auto-redirecting node number urls back to aliased paths (so people don't bookmark the ugly node number url).
Comment #8
micropat commented