A Symphony extension that integrates with YOURLS
- Upload the
yourls
folder to your Symphony/extensions
folder. - Enable it by selecting the "YOURLS", choose Enable from the with-selected menu, then click Apply.
- Add your domain and signature values to your Preferences
- You can now add the "YOURLS" field to your sections.
The goal is to create a Symphony page that best represents your content as a permalink. The classic example of this is a blog with articles. The permalink structure might be /article/135/my-article
.
Add the YOURLS
field to your desired section, and enter the URL Structure of your permalink. The URL Structure field accepts full XPath expressions which will be evaluated against the XML of the Entry when saved.
For example, let's assume your permalink structure is /article/:year/:month/:date/:id/:handle
and you have a simple section with a Text Input, Date and YOURLS field. The XML for a single entry may return something like the following XML:
<data>
<entry id="174">
<title handle="hello-moto">Hello moto</title>
<date iso="2013-11-11T23:04:35+10:00" time="23:04" weekday="1" offset="+1000">2013-11-11</date>
</entry>
</data>
The URL Structure for the relevant permalink is:
/article/{substring(entry/date/@iso, 0, 5)}/{substring(entry/date/@iso, 6, 2)}/{substring(entry/date/@iso, 9, 2)}/{entry/@id}/
By default, short URLs generated by YOURLS will be automatically generated, however if 'Allow custom slugs' is enabled, Authors will be able to enter their own slug which YOURLS will then use for the short URL.
- Opens the section and creates a new Entry
- If the field allows custom slugs, an input field is shown asking the author for the custom slug.
- Author enters custom slug, or leaves it empty (autogenerated) and hits Create Entry
- A new shortlink is created in YOURLS which references the URL structure set in the field, eg.
http://example.com/article/135/my-article