Share to ChatGPT widget adds one-line page sharing

A new embeddable Share2ChatGPT widget lets sites open ChatGPT with the current page pre-loaded as a prompt. The script is one file, uses data attributes for setup, and supports themes, sizes, languages, and a direct redirect URL.

Share to ChatGPT widget adds one-line page sharing

A new Share2ChatGPT widget lets website owners add a one-line button that opens ChatGPT with the current page already inserted as the prompt. The project is presented as a zero-dependency embed that uses a single script tag and auto-detects the page URL and title.

According to the project’s description, the widget is meant to make it easier to “share to ChatGPT in one line.” The basic embed is simple: place a <div data-share2chatgpt></div> on the page and load https://share2chatgpt.franzai.com/share2chatgpt.js asynchronously.

⚡ New to this?

This is a small developer tool for adding a “share this page to ChatGPT” button to a website. ChatGPT is OpenAI’s chatbot, and the widget builds a prompt from the current page’s URL, title, or custom text so a user can send that context into a chat.

For non-experts, the main point is that websites can now hand off a page to ChatGPT with very little setup. The terms “widget” and “data attributes” just mean a reusable button and a set of HTML settings that control how it looks and behaves.

🦞 OpenClaw angle

If you run self-hosted documentation, admin portals, or knowledge bases, this kind of widget can be useful for turning a page into a ChatGPT prompt with minimal code. Add it only where you are comfortable sending page content to an external service, and make the default behavior explicit in your UI so users know what will be shared.

If you build internal automation tools, consider exposing a similar “send to assistant” action using your own prompt builder, not just a public ChatGPT link. Use the same pattern of URL, title, and snippet inputs so your agents can generate context-rich prompts from the current page or ticket without extra manual copying.

The button picks up the page it is embedded on by default. If site owners want to override that, they can set data-url, data-title, or data-text attributes, while leaving the rest to smart defaults.

The project says only absolute http:// or https:// URLs are accepted when the default page URL is overridden. It also supports a templated prompt with data-prompt, where {url}, {title}, and {text} can be inserted into the ChatGPT prompt.

The widget includes a few other settings for how ChatGPT should receive the request. These include data-hints for a search mode that uses web results, and data-temporary-chat to open a temporary chat so history is not saved, according to the project documentation.

For presentation, Share2ChatGPT offers three themes, three sizes, and three variants. The available theme choices are light, dark, and minimal, while size options are small, medium, and large.

Language support is built in as well. The project says the prompt, label, and default text adapt to the selected language, with en, de, es, and fr currently supported through the data-lang attribute.

The project also exposes a JavaScript API for more advanced use. According to the documentation, developers can call Share2ChatGPT.init() to rescan the DOM after dynamic content loads, or use Share2ChatGPT.buildUrl() to create a ChatGPT link programmatically.

That means the widget is not limited to static pages. Sites that render content after the initial load can re-run initialization so the button picks up new content, and developers can also skip the widget entirely and use the direct redirect URL pattern shown in the project notes.

The project’s example redirect link points to share2chatgpt.franzai.com/go/ with URL and language parameters. It is presented as an alternative for cases where a site just wants to send users directly to a ChatGPT share link without embedding the button itself.

Source: HN Show HN ↗

More from OpenClaw News