Configuring URL Formats
You may create multiple URL formats. The formats are tested to see if they match the ANS document based on the criteria. The order they are tested is based on the priority. The matching format will be used to generate the canonical URL.
Priority
Each format criteria will be tested against the ANS document in order based on the priority. 1 is the highest priority.
Criteria
The criteria is a JSON document. A match occurs when the ANS document provided has fields that match the criteria.
Here is an example criteria that matches an ANS document.
Criteria
{ "type": "story" }
ANS document
{ "_id": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "version": "0.7.1", "type": "story", "display_date": "2018-01-01T12:01:01.0Z", "publish_date": "2018-01-01T14:49:00.10Z", "headlines": { "basic": "The default headline for this story", "twitter": "Twitter headline!" }, "websites": { "washpost": { "website_section": { "_id": "/books", "_website": "washpost", "type": "section", "version": "0.6.0", "name": "Books", "path": "/books", "parent_id": "/", "parent": { "default": "/" } } } } }
Format settings
You can apply the formats in sequence. For example, %websites.washpost.website_section._id|trimPath({"count":1})|slugify({"maxLength":20})%
Tag | Description |
---|---|
| The year of the post, four digits, for example, 2004 |
| Month of the year, for example 05. You can pass |
| Day of the month, for example 28. You can pass |
| Hour of the day, for example, 15. This tag respects the hour format set for the organization. If the format is set to 24, then hours are |
| Morning or afternoon. If your organization uses the 24-hour format, then this is empty. Otherwise, it returns either |
| Minute of the hour, for example, 43. You can pass |
| Second of the minute, for example, 33. You can pass |
| Slugify the headline. |
| Removes filler words from headline. Words that are removed: a, at, as, the, in, from, for, of, on, to, and, but. Also removes all characters except - (hyphen), ' (apostrophe), \s (whitespace characters), and letters. For example, Foo, bar, and baz! becomes Foo bar baz. |
| Removes ends of common contractions from headline, excluding 't. Ending contractions that are removed: 'll, 's, 've, and 're. Also removes all characters except - (hyphen), ' (apostrophe), \s (whitespace characters), and letters. For example, I'll becomes I, you're becomes you, and we're becomes we. |
| Remove the forward slash. |
| Remove all path prefixes. For example, "/foo/bar/baz" becomes "baz". |
| Remove the first path prefix. For example, "/foo/bar/baz" becomes "bar/baz". |
| Remove two trailing items from a path. For example, "/foo/bar/baz" becomes "foo". |
| Substitute a field value with a different field value if another field value exists in the document. For example, |
| Any element within the ANS document. For example:
|