In my website a webpage contains different news each links to different pages which has detail info. I put sharethis button under each news headings. But when I started sharing specific headline the current webpage where all the news headings are shown is shared. Is there any alteration needed to the dowloaded shathis button code? Can any one help me solve this problem please..

Dani AI

Generated

— this is almost always a widget/config issue rather than CSS. As observed, the share script will use the current page URL by default unless each button is explicitly given the article URL; that explains why the listing page is being shared. was right that something in the site code needs fixing, but it’s unlikely to be styling — it’s the share markup/JS.

Quick troubleshooting checklist:

  • Inspect one of the failing buttons in the browser (right‑click → Inspect) and confirm whether the element carries a per‑item URL (an href or a data- attribute).
  • If the widget only calls document.location, provide a per-button override (either an href that points to the share endpoint, or a data attribute the widget supports).
  • Ensure the URL is absolute (including protocol and domain) and properly encoded with encodeURIComponent when inserted into query strings.
  • Test by copying the final share URL into a new tab to verify the service receives the intended article URL.

Two practical fixes:

  1. Use service share endpoints per item (no third‑party script required). Example anchors:
    
    <a href="https://www.facebook.com/sharer/sharer.php?u=https://example.com/article/123" target="_blank" rel="noopener noreferrer">Share on Facebook</a>

<a href="https://twitter.com/intent/tweet?url=https://example.com/article/123&text=Short+headline" target="_blank" rel="noopener noreferrer">Tweet</a>



2) If keeping the ShareThis/third‑party widget, render a button per article that includes the article URL in whatever attribute that widget accepts (many support `data-url`/`data-href` or an `href` to the share endpoint). Alternatively, open the share window yourself with a small onclick script that reads a `data-url` on the button and calls the service URL.

Extra notes: always include `rel="noopener noreferrer"` with `target="_blank"`, and remember that preview text/image comes from the shared page’s Open Graph tags (set those on the article detail pages, not the listing).

Recommended Answers

All 2 Replies

Member Avatar for Member #949455

Sharing button picking the wrong url in webpage containing number of url.

This sounds more like a code issue than a question regarding Social Media and Communities.

If the button is not working correctly then it's a code issue.

there would some css or code issue in your site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.