Autolink extension for the Bolt CMS. Finds webpages relevant to an entry or page and inserts links to these pages. The extension uses Google Custom Search which makes it possible to restrict the search to certain websites, i e newspapers or blogs in a certain country.
This extension is based on the RSSAggregator code by Sebastian Klier & Gawain Lynch and adapted by Mattias Lundbäck.
This version is adapted for Bolt 3.x and includes some improvements, most notably that it is now possible to get a thumbnail picture to illustrate the automatically generated links. The thumbnail is generated by the service thumbalizer, but can be substituted for any similar service or even a script on the users server.
Instructions
=======================
-
Activate autolink in the Extension menu in Bolt 3.x.
-
Place the
{{ autolink() }}
tag function in your template. You will need to first generate links by using Google Custom Search engine. This is done by putting a Twig-tag in your template, e g {{ autolink('CSE-ID', record.title) }}, where CSE-ID is the ID of your custom search engine and record title is a string. It can also be a constant, like 'flowers' or something else. An example of how to use it is in the partial .twig template in the "assets" folder. -
Place the {{ autolinkitem() }} tag where you want the link to appear. You can use multiple tags where you want items to appear, but you need to provide three arguments: {{ autolinkitem(record.title, field-type, item-number) }}. The first item is the same as above, the second is the field type and can be either id, title, author, summary or tumnagel. 'id' is the link itself, 'title' is the title of the webpage, 'author' is the base url of the webpage, 'summary' is a short summary of the content and 'tumnagel' is the route to the thumnail picture that autolink stores in the public/extensions/autolink folder. All the cached searches are also stored in that folder with the extension .html.
-
There are two settings:
config: thumbnail_url: 'https://api.thumbalizr.com/?url=%url%&width=300&quality=80&encoding=jpg&mode=screen&api_key=' google_cse_url: 'https://www.googleapis.com/customsearch/v1?key=[key]&cx=%cse%&q=%search%&alt=atom'
The thumbnail_url does not need to be altered, but in the setting for google_cse_url you need to replace '[key]' with your google custom search api-key. You cannot use mine.
How to get the API and ID is decribed by Google at this address: https://developers.google.com/custom-search/json-api/v1/using_rest
For how to create the Custom Search Engine look at this page: https://developers.google.com/custom-search/docs/overview. You need a Google account.
- Look in the autolink.twig folder for an example how to create a loop to publish ten links with thumnails.
Override the CSS styles defined in Autolink/assets/autolink.css in your own stylesheet.
No support, you are on your own.
Please use the issue tracker: Github