=== via.mg ===
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.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A short link for every story you publish, and a share preview that looks its best on Facebook and WhatsApp. Handmade in Madagascar.

== 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 ==

= 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.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.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.
