Skip to content

InPoint-Automation/HreflangAutoLinker

Repository files navigation

Hreflang Auto-Linker

Icon

Description

Hreflang Auto-Linker is a Publii plugin that manages hreflang tags across a pair of multilingual sites. It pairs your posts, pages, and tags with their equivalents on another copy of the site through a central mapping UI, then injects the correct <link rel="alternate" hreflang="..."> tags into every page at build time and sets the page's <html lang="..."> attribute. Works for any two-language site pair.

Features

  • Injects <link rel="alternate" hreflang="..."> tags for posts, pages, and tags
  • Sets <html lang="..."> from the configured site language
  • Mapping UI to pair local content with partner-site content - reads the partner site database directly
  • Validates all published content and logs any unmapped items
  • Configurable this-site language, partner site directory, partner language, and partner base URL

Requirements

Publii 0.46.0 or newer.

Installation

  1. Download the release ZIP.
  2. Publii -> Tools -> Plugins -> Install plugin -> pick the ZIP.
  3. Enable the plugin for the site.

Usage

Open Plugins -> Hreflang Auto-Linker -> settings icon and fill in this site's language code, the partner site's directory name, its language code, and its base URL. Choose which site x-default points to. Then open the mapping UI to pair each local post/page/tag with its partner-site equivalent and save. Tags are injected on the next site render.

[!IMPORTANT] Repeat this process and configure the plugin with opposing settings from the other site as well or these links will not be bidirectional.

screenshot

Contributing

Feel free to fork this project or contribute a PR. Build instructions can be found in the developer readme DEV.md.

Licenses

Main code

This project is licensed under the GPLv3+. See LICENSE file for details.

Third-Party Components

The rendered site output (main.js) is self-contained plain JavaScript with no dependencies. The mapping UI bundles one library:

Bundled assets

Credits

This project was developed by InPoint Automation Sp. z o.o. https://inpointautomation.com/

Thanks to the Publii project for the CMS and plugin API.

Changelog

See CHANGELOG.md for the full version history.

About

A Publii plugin that manages hreflang tags across a pair of multilingual sites for pages, posts, and tags

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors