Perlkonig / grav-plugin-backlinks

Keeps a list of internal links (pages that link to other pages)

Home Page:https://www.perlkonig.com/demos/backlinks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backlinks Plugin

Abandonment Notice: I'm afraid I simply don't have the time to maintain my Grav themes and plugins. Those interested in taking over should refer to the "Abandoned Resource Protocol". Feel free to fork and replace. So long, and thanks for all the fish.

The Backlinks Plugin is for Grav CMS. For each page in your site, it records all other pages that point to it. In wikis, these are commonly called "backlinks."

For a demo, visit my blog.

Installation

Installing the Backlinks plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.

GPM Installation (Preferred)

The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's terminal (also called the command line). From the root of your Grav install type:

bin/gpm install backlinks

This will install the Backlinks plugin into your /user/plugins directory within Grav. Its files can be found under /your/site/grav/user/plugins/backlinks.

Manual Installation

To install this plugin, just download the zip version of this repository and unzip it under /your/site/grav/user/plugins. Then, rename the folder to backlinks. You can find these files on GitHub or via GetGrav.org.

You should now have all the plugin files under

/your/site/grav/user/plugins/backlinks

NOTE: This plugin is a modular component for Grav which requires Grav and the Error and Problems plugins to operate.

Configuration

Before configuring this plugin, you should copy the user/plugins/backlinks/backlinks.yaml to user/config/plugins/backlinks.yaml and only edit that copy.

Here is the default configuration and an explanation of available options:

enabled: true
datafile: 'backlinks.yaml'  # relative to `user/data`
  • The enabled flag turns the plugin off and on.

  • datafile points to a file relative to the user/data folder where you want the backlinks data to live.

Usage

The plugin runs during the onShutdown event, which occurs after the connection has been closed with the user, so it should have no impact on user experience. It should also only run once per cache instance—meaning it should only run the first time a page is viewed after the cache is cleared. After that the plugin should be ignored until the cache is cleared again.

The data is made available to Twig templates via the backlinks variable. This contains all the backlink data, not just the data for the requested page. The data is in the form of an associative array:

route => [pages, that, link, to, route]

About

Keeps a list of internal links (pages that link to other pages)

https://www.perlkonig.com/demos/backlinks

License:MIT License


Languages

Language:PHP 100.0%