=== via.mg – Auto Short Links & Social Previews ===
Contributors: viamg
Tags: url shortener, whatsapp, social preview, open graph, madagascar
Requires at least: 5.6
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Every post gets a short link, and a share preview that looks right on WhatsApp and Facebook.

== Description ==

A short link for every story you publish, and a share preview that looks its best on Facebook and WhatsApp. via.mg is a small, handmade URL shortener from Madagascar, built to be genuinely enjoyed, and to give you back control of the links you share.

This plugin connects your WordPress site to your via.mg account. Every time you publish a post, it automatically gets its short link, and republishing never creates a duplicate. The short link appears on the edit screen and in the posts list, ready to copy.

**What the plugin does**

* A short via.mg link for every published post, without thinking about it.
* No duplicates: republishing or updating always reuses the same link.
* A clean social preview: title, excerpt and featured image reused for Facebook and WhatsApp (optional).
* The short link shown on the edit screen and in the posts list, with a copy button.
* Never blocks publishing: if the network fails, the link is picked up on the next save.

**What the plugin does not do** (on purpose)

No shortcodes, no Gutenberg block, no statistics inside WordPress, no permalink replacement. via.mg does one thing and does it well.

== External services ==

This plugin connects your site to **via.mg** (https://via.mg), an external URL shortening service. It cannot work without it: short links are created and stored on via.mg, not on your site, and using the plugin requires a free via.mg account and an API token.

Please note that the author of this plugin also operates the via.mg service. The data described below is therefore sent to a service run by the plugin author, and not to an unrelated third party.

The plugin contacts https://via.mg from your WordPress admin only, and only once you have saved an API token. What is sent depends on the action:

* **Testing the connection** (Settings > via.mg): your API token, so via.mg can confirm it is valid.
* **Publishing a post** with shortening enabled: your API token, the post permalink and its title. If the social preview option is on, the post excerpt and the URL of its featured image are sent as well.
* **Updating a post that already has a short link**: your API token, the via.mg identifier of that link, and the same title, excerpt and featured image URL, so the share preview stays in step with the post.

Nothing else is sent. There is no analytics, no telemetry, and no request at all before a token is saved. Requests identify themselves as "via-mg-wp" followed by the plugin version, which says nothing about your site.

Storage, retention and deletion of that data are governed by the via.mg service:

* Terms of Service: https://via.mg/conditions
* Privacy Policy: https://via.mg/confidentialite

== Installation ==

1. Install and activate the plugin.
2. Create an API token from your account at https://via.mg/compte/api.
3. In WordPress, go to Settings > via.mg, paste the token and click "Test connection".
4. Publish a post: its short link appears in the via.mg column.

== Frequently Asked Questions ==

= Is it really free, and why? =

Yes. No ads, no tracking of your readers, no data resold, and no paid tier waiting to close over features you already use. via.mg is a small self-funded product from Madagascar; the plugin is free and open source.

= What happens to my links if via.mg shuts down? =

Your site is unaffected. The plugin never replaces a permalink: the canonical address of a post stays your own site's URL. If via.mg disappeared, your posts would keep working exactly as before, and only the short links already shared would stop resolving. That is a narrow promise, but it is one we can actually keep.

= What exactly leaves my site? =

Four things, and nothing else: the post's address, its title, its description and the address of its featured image. No reader data, no IP addresses, no visitor statistics, no subscriber lists. The plugin also sends an explicit `via-mg-wp/` user agent so that via.mg stops receiving your site's address, which WordPress would otherwise include by default.

= Does it conflict with my SEO plugin? =

No. The plugin writes no `og:` tag into your site, so Yoast, Rank Math, AIOSEO or SEOPress keep full control of your pages. via.mg serves the share preview on the short link's own page. The honest corollary: this preview only applies when the short link is what circulates. When someone shares your normal post URL, your SEO plugin decides the preview, as it always did.

= Can it slow down or block publishing? =

No. The call has an 8 second timeout, and a network failure is simply retried the next time you save. Publishing never waits on via.mg.

= Do I need a via.mg account? =

Yes. The plugin acts on behalf of your via.mg account using a token you create at https://via.mg/compte/api. Creating an account is free.

= Does republishing a post create a second link? =

No, never. via.mg recognizes a destination that has already been shortened and returns the existing link.

= What happens if I duplicate a post? =

The copy gets its own short link. A short link belongs to the post it was created for, so a duplicate never inherits it and never overwrites the original's share preview.

= Where are the statistics? =

On via.mg, in your "My links" area. The plugin links there from the edit screen.

= Is my token safe? =

It is stored in your site's database, in the options table, and the settings screen never shows it again once saved: the field stays empty, and leaving it empty keeps the token you already saved. It is never included in a WordPress content export. Treat a database backup as sensitive, and revoke the token from your via.mg account if you ever suspect it leaked.

= In which language is the plugin? =

The admin interface is in English, the plugin's source language. French and Malagasy translations are delivered by WordPress.org once available, so the plugin follows your site's language.

== Screenshots ==

1. Settings > via.mg: the token, the connection test, and the shortening options.
2. The short link on the post edit screen, ready to copy.
3. The via.mg column in the posts list.

== Changelog ==

= 1.2.2 =
* Display name and plugin header now match, and the listing describes what the plugin does.

= 1.2.1 =
* The short link is no longer cut off in the block editor sidebar: the copy button now wraps below the field when space is tight.

= 1.2.0 =
* Duplicating a post no longer copies its short link: the copy now gets its own, and the original's share preview is left alone.
* The saved API token is no longer written back into the settings form, and can be removed from there.
* Internal renaming for stricter prefixing, and the settings script and styles are now enqueued instead of inlined.

= 1.1.0 =
* The plugin now identifies itself to via.mg as "via-mg-wp". WordPress used to send its default user agent, which includes your site address; via.mg no longer receives it.

= 1.0.0 =
* First release: automatic shortening on publish, social preview, meta box and column.

== Upgrade Notice ==

= 1.2.2 =
Naming only. Nothing changes in how the plugin works.

= 1.2.1 =
The short link is now fully readable in the block editor sidebar.

= 1.2.0 =
A duplicated post now gets its own short link instead of sharing the original's.

= 1.1.0 =
Your site address is no longer sent to via.mg in the request header.

= 1.0.0 =
First public release.
