# Links Plugin

The links section used to be an integral part of the Geeklog core code, but have been moved to a plugin as of Geeklog 1.4.0.

## Configuration

The configuration of the Links plugin can be changed from the Configuration admin panel:

### Public Links List Settings

Variable | Default Value | Description
--- | --- | ---
linksloginrequired | 0 | When set to 1, only registered users can access the links section. Please note that `$_CONF['loginrequired']` in Geeklog's main configuration takes precedence over this setting. So when `'loginrequired'` is set to 1, anonymous users can not access the links section even when `'linksloginrequired'` is set to 0.
linkcols | 3 | The number of link categories to display per column.
linksperpage | 10 | The number of links to show per page.
show_top10 | `true` | When both `$_LI_CONF['linkcols']` and `$_LI_CONF['linksperpage']` are not 0, the plugin will show a list of the 10 most clicked-on links on the Links plugin's index page automatically. If you do not want that "top 10" list there, set this option to `false`.
show_category_descriptions | `true` | Whether to show subcategory descriptions when viewing a category or not.
new_window | `false` | Whether to open external links in a new window or not. Note: Use this option with care. It takes control away from your users and may confuse or annoy them.

### Links Admin Settings

Variable | Default Value | Description
--- | --- | ---
hidenewlinks | 0 | Whether new links should be hidden from the "What's New" block (when set = 1) or whether to list them there (when set to = 0).
newlinksinterval | 1209600 | For how long a link should be considered "new" and show up in the "What's New" block on the site. The interval is given in seconds, so the default value equals 14 days.
hidelinksmenu | 0 | Whether to hide the "Links" entry from Geeklog's menu bar (when set to 1) or to show it (when set to 0).
linksubmission | 1 | Whether links submitted by users will have to be approved by an admin first (when set = 1) or show up immediately (when set = 0).
notification | 0 | Whether to send an email notification when a new link was submitted (when set to = 1) or not (when set to = 0).
delete_links | 0 | Defines what to do when a user is deleted that is the owner of a link. When set to 0, all links owned by the deleted user will be assigned to a user of the "Root" group (e.g. the site admin). When set to 1, the links are deleted.

aftersave

'list'

Which page to go to after a links has been saved:

- 'item': go to the linked site(!)
- 'list': show admin's list of links (default)
- 'plugin': display the public list of links
- 'home': display the site's homepage
- 'admin': go to the "Admin Home" page, i.e. Command & Control

root | 'site' | ID to use for the root of the link categories tree.

## Layout of the Links plugin's index page

The general layout of the index page of the Links plugin is defined by the options `$_LI_CONF['linkcols']` and `$_LI_CONF['linksperpage']`, as explained above.

If you'd rather have a straight list of all your links, you can set both of these options to 0. This probably makes the most sense when you only have a few links. Setting only `$_LI_CONF['linksperpage']` to 0 zero will list all the links of the current category on one page. Setting only `$_LI_CONF['linkcols']` to 0 will hide the categories and will display all your links spread over several pages.

### Template files

To further change the layout of your Links section, you can change the template files. Please note that they are now located in the plugin's directory, i.e. in

`/path/to/geeklog/plugins/links/templates/`

If you're using a theme that was made for an older version of Geeklog (prior to Geeklog 1.4.0), you may still have a "links" directory in your theme's directory - but that is not used any more and can be safely removed.

## Autotags

The Links Plugin provides one autotag, `[link:]`. You can use this autotag to embed one of the links from your site's Links section into an article or a comment (amongst other things) without having to type out the full URL. Simply add the link's ID after the colon. It will then create a link to the site in question and use the link's title as the link text. Alternatively, you can add your own link text after the ID (but before the closing bracket).

For example, on geeklog.net:

- `[link:20030921074903113]` will be translated to: `<a href="http://www.geeklog.net/links/portal.php/link/20030921074903113">Groklaw</a>`
- `[event:20030921074903113 read everything about the SCO case]` will be translated to: `<a href="http://www.geeklog.net/links/portal.php/link/20030921074903113">read everything about the SCO case</a>`

Note that the `[link:]` autotag will always create links that go through Geeklog's `portal.php` script so that the number of clicks on that link can be counted.