URL display and modifying
Displaying the URL
Purpose:
"uripath" prints only the path part of the URI, the part before the parameters list. If "/en/1/2/3?param1=text" was the full URI, the URI path is "/en/1/2/3".
"urlparameters" prints the runtime environment parameters in URL format.
"uri" prints the complete link URI and it is equivalent to:
{{ uripath }}?{{ urlparameters }}
"url" prints the complete URL in the form:
http://[site_alias][uri]
It is equivalent to:
http://{{ $gimme->publication->site }}{{ uri }}
Note:
- All four statements work for both template path and short URL types. Depending on the URL type, the statement displays the proper link
- For publications with short URL type the only way to create links is to use these three statements: either url, uri, uripath or urlparameters. It is not possible to build the URI manually
Syntax:
{{ url [options="<options_list>"] }}
{{ uri [options="<options_list>"] }}
{{ uripath [options="<options_list>"] }}
{{ urlparameters [options="<options_list>"] }}
Filters:
- <options_list>=
-
- <option> <list_of_options>
- <option>
- <option>=
-
- fromstart
- reset_issue_list
- reset_section_list
- reset_article_list
- reset_searchresult_list
- reset_subtitle_list
- image <image_number> <image_options>
- root_level
- language
- publication
- issue
- section
- article
- template <template_name>
- articleAttachment
- articleComment
- audioAttachment
- previous_subtitle <field_name>
- next_subtitle <field_name>
- all_subtitles <field_name>
- previous_items
- next_items
<image_number> is an <integer_value> representing a valid number of article images
<template_name> is a <string value> representing the full path of a valid template
- fromstart: prints the url corresponding to the received request, before any changes were made to the template runtime environment (useful when building site maps)
- reset_issue_list: reset list counters for the issues list
- reset_section_list: reset list counters for the sections list
- reset_article_list: reset list counters for the articles list
- reset_searchresult_list: reset list counters for the search results list
- reset_subtitle_list: reset list counters for the subtitles list
- image: print image parameters in order to show an image in a template; if you use this statement inside the "List of Article Images" statement the image number value is not mandatory. The image options are different depending on the Newscoop version
For Newscoop versions 3.0-3.3:
<image_options>=<image_ratio>.
The "image_ratio" parameter is an integer between 1 and 100. The image will be scaled from 1% of it's size to 100% based on the image ratio parameter.
For Newscoop versions 3.4 and newer:
<image_options>=<image_ratio>|width <width>|height <height>.
The "image_ratio" parameter is the same as above. You can specify an image to be resized to the given width or height.
E.g.: {{ uri options="image 1 width 100 height 100 }}
- root_level: this link will have all parameters reset: language, publication, issue, section, article, subtitle, lists, indexes etc.
- language: this link will have all parameters above language reset: publication, issue, section, article, subtitle, lists, indexes etc.; the language parameter remains unchanged
- publication: this link will have all parameters above publication reset: issue, section, article, subtitle, lists, indexes etc.; the language and publication parameters remain unchanged
- issue: this link will have all parameters above issue reset: section, article, subtitle, lists, indexes etc.; language, publication and issue parameters remain unchanged
- section: this link will have all parameters above section reset: article, subtitle, lists, indexes etc.; language, publication, issue and section parameters remain unchanged
- article: this link will have all parameters above article reset: article, subtitle, lists, indexes etc.; language, publication, issue, section and article parameters remain unchanged
- template <template_name>: this link will set the template in the link to <template_name>
- articleAttachment: displays the link for the current article attached document
- articleComment: inserts the article comment identifier in the parameters list; if no article comment was defined in the template environment, no parameter is inserted. This attribute is needed if you want to pass on the current comment id to another page for display purposes
- audioAttachment: displays the link for the current audio file attached to the article
- previous_subtitle <field_name>: add a parameter to the URI to select the previous subtitle of the given <field_name> for display
- next_subtitle <field_name>: add a parameter to the URI to select the next subtitle of the given <field_name> for display
- all_subtitles <field_name>: add a parameter to the URI to select all subtitles of the given <field_name> for display
- previous_items: add a parameter to the URI to select the previous interval of the current list items for display
- next_items: add a parameter to the URI to select the next interval of the current list items for display
Constraints:
None.
Examples:
For the canonical tag often used for SEO (search engine optimization) you should use...
<link rel="canonical" href="{{ url options="article" }}" />
<link rel="canonical" href="{{ url options="section" }}" />
- on front page / index level
<link rel="canonical" href="http://{{ $gimme->publication->site }}" />