Skip to main content
With the $wsViews module, you can access information about the current page and generate URLs to other shop pages. Typical use cases are SEO optimization (meta tags, hreflang), navigation, and conditional content based on the current template. In this section, you will learn how to access page data and generate SEO-friendly URLs.

Module overview

Example / excerpt of $wsViews
{{= $wsViews | json }}
JSON output
{
  "current": {
    "closedShopRedirected": false,
    "ctrlName": "...",
    "info": { },
    "name": "...",
    "paramList": [...],
    "params": { },
    "robotOptions": [...],
    "status": 200,
    "getHreflangAutomatic": "ƒ()",
    "url": "ƒ()"
  },
  "host": "...",
  "getHreflangManual": "ƒ()",
  "identifyUrl": "ƒ()",
  "metaDescription": "ƒ()",
  "metaTitle": "ƒ()",
  "setChildUrl": "ƒ()",
  "url": "ƒ()",
  "viewUrl": "ƒ()"
}
Note: ƒ() denotes a function. Variables and methods overview
NameReturn typeDescription
currentmapInformation about the current page.
closedShopRedirectedboolChecks whether a redirect from a closed shop has occurred.
ctrlNamestringName of the view controller.
getHreflangAutomaticfunctionReturns the values of the hreflang tags of the current page.
infomapAdditional info from the controller (e.g. category, product).
namestringName of the view file (e.g. "start.htm").
paramListarrayList of URL parameters with name and value.
namestringName of the parameter.
valuestringValue of the parameter.
paramsmapURL parameters as a map ({name: value}).
robotOptionsmapRobots settings of the page.
statusnumberHTTP status code (e.g. 200).
hoststringReturns the URL of the home page.
metaDescriptionstringMeta description of the current page, page description.
metaTitlestringMeta title of the current page; page title.
urlstringReturns the currently accessed URL.
viewUrlstringBuilds a URL to a view using the specification of a view controller and its parameters.
current.url()stringGenerates an SEO-friendly URL to a shop page.
url()stringBuilds a link to a shop page.
viewUrl()stringGenerates a URL to a template file.
metaTitle()stringReturns the page title for the browser tab and search results.
metaDescription()stringReturns the page description for search results.
getHreflangManual()arrayReturns manually configured hreflang entries.
current.getHreflangAutomatic()arrayReturns the language versions of the current page for hreflang tags.

Variables

$wsViews.current

Contains all information about the currently displayed page.
{{= $wsViews.current | json }}

$wsViews.current.ctrlName

Returns the name of the view controller that delivers the current page.
View controller: {{= $wsViews.current.ctrlName }}

$wsViews.current.closedShopRedirected

Returns whether the user was redirected from a closed shop.
{{ if $wsViews.current.closedShopRedirected }}
  // Redirected from closed shop
{{ /if }}

$wsViews.current.info

Returns context-specific data, e.g. the current product on product pages (info.product) or the category on category pages (info.category).
Additional information: {{= $wsViews.current.info}}

$wsViews.current.name

Returns the name of the current view.
{{ if $wsViews.current.name == "category.htm" }}
    // Category page
{{ /if }}

$wsViews.current.paramList

Returns a list of URL parameters. Each entry contains name and value.
{{ foreach $myParam in $wsViews.current.paramList }}
  {{= $myParam.name }}: {{= $myParam.value }}
{{ /foreach }}

$wsViews.current.params

Returns the URL parameters as a map.
{{ if $wsViews.current.params.promoCode }}
  Promo code: {{= $wsViews.current.params.promoCode }}
{{ /if }}

$wsViews.current.robotOptions

Returns the robots settings of the page.
Robots: {{= $wsViews.current.robotOptions | json }}

$wsViews.current.status

Returns the HTTP status code of the page.
Status: {{= $wsViews.current.status }}

$wsViews.host

Returns the URL of the shop’s home page.
Shop home page: {{= $wsViews.host }}

Methods

$wsViews.current.url()

Generates an SEO-friendly URL to a shop page. The URL is automatically generated with descriptive paths (e.g. /produkte/beispiel-produkt instead of ?productId=123). Signature
$wsViews.current.url()
Return value
string - Current URL / path.
Example that outputs the current URL.
Current URL: {{= $wsViews.current.url() }}

$wsViews.url()

Builds a link to a shop page (e.g. product page, category page). The URL is automatically generated in SEO-friendly format. Signature
string $wsViews.url(viewCtrl, params)
Return value
string - URL/path to the desired page.
Parameters
NameTypeRequiredDescription
viewCtrlstringyesTarget controller / page type (e.g. Product, Category)
paramsmapyesParameters to supplement/override the URL; the value null removes a parameter.
Example
Example that generates a URL to a product page.
{{= $wsViews.url('Product', {productId: $cProduct.product.id}) }}
Return example:
/produkte/beispiel-produkt-12345

$wsViews.viewUrl()

Generates a URL to a template file. Signature string wsViews.viewUrl(path, params, type) Return value
string - URL to the specified view.
Parameters
NameTypeRequiredDescription
pathstringyesPath to the template file, e.g. account/forgotPassword.htm.
paramsmapnoAdditional parameters for the URL.
typestringnoURL type (e.g. "absolute").
Example that generates a URL to the forgot-password page:
<a href="{{= $wsViews.viewUrl('account/forgotPassword.htm') }}">
  Forgot password?
</a>

$wsViews.metaTitle()

Returns the page title for the browser tab and search results. Signature
string $wsViews.metaTitle()
Return value
string - Page title.
Example that sets the meta title in the HTML head:
<title>{{= $wsViews.metaTitle() }}</title>

$wsViews.metaDescription()

Returns the page description for search results. Signature
string $wsViews.metaDescription()
Return value
string - Page description.
Example that sets the meta description in the HTML head.
<meta name="description" content="{{= $wsViews.metaDescription() }}">

$wsViews.getHreflangManual()

Returns manually configured hreflang entries. Signature
$wsViews.getHreflangManual()
Return value
array - List of manual language versions.
Example that outputs manual hreflang links.
{{ foreach $myHref in $wsViews.getHreflangManual() }}
  <link rel="alternate" hreflang="{{= $myHref.lang }}" href="{{= $myHref.href }}">
{{ /foreach }}

$wsViews.current.getHreflangAutomatic()

Returns the language versions of the current page for hreflang tags. Signature
$wsViews.current.getHreflangAutomatic()
Return value
array - List of language versions (lang, href).
Example that outputs automatic hreflang links.
{{ foreach $myHreflang in $wsViews.current.getHreflangAutomatic() }}
  <link rel="alternate" hreflang="{{= $myHreflang.lang }}" href="{{= $myHreflang.href }}">
{{ /foreach }}

Actions

No actions are available for $wsViews.

Examples for URL and parameter access

View URL & host

<link rel="canonical" href="{{= $wsViews.host }}{{= $wsViews.current.url() }}" />

{{= $wsViews.current.url() }}

Template-conditional content output

...
{{ if ($wsViews.current.name == "start") }}
  
  <section class="hero">…</section>
{{ /if }}
...

Reading parameters (list & specific query)

Iteration over all parameters:
...
<ul class="params">
  {{ for (p in $wsViews.paramList) }}
    <li>{{= p.name }} = {{= p.value }}</li>
  {{ end }}
</ul>
...
Specific check (example “otp”):
{{ if ($wsViews.params.otp && $wsViews.params.otp == "required") }}
  <div class="notice notice--otp">Please enter the one-time password.</div>
{{ /if }}

Hreflang & meta (short examples)

...
<title>{{= $wsViews.metaTitle() }}</title>
<meta name="description" content="{{= $wsViews.metaDescription() }}" />

{{ for (h in $wsViews.getHreflangAutomatic()) }}
  <link rel="alternate" hreflang="{{= h.lang }}" href="{{= h.href }}" />
{{ end }}

{{ for (h in $wsViews.getHreflangManual()) }}
  <link rel="alternate" hreflang="{{= h.lang }}" href="{{= h.href }}" />
{{ end }}
...