Widget:GetRecommendations

From Open Energy Information

This widget generates a list of recommended entries from OpenEI.org/search related to the page on which it is embedded or the given topic.

Parameters
  • element (required) = DOM element string, such as #recommendationDiv or .recommendationClass
  • topic or url (required)
    • topic = string to use to retrieve search results, such as "Solar"
    • url = url string from a base of OpenEI.org/wiki/, such as "Gateway:Solar"
    • Either topic or url is required. If both are provided, only topic will be used.
  • randomizeResults (optional, default: false) = true or false to show differing results every time; default: true; this is done by expanding the result set and randomizing the rows that are returned
  • type (optional) = an array of type and number of types to return
    • default: one each of Articles, Images, Documents, Definitions, Community, Datasets, Help Pages, Map Files
    • Ex: to include 1 article and 2 images, add the parameters "type=Articles|type=1|type=Images|type=2".  The first call to type specifies the type, the second call specifies the number
    • Ex: to include 2 of every type, add the parameters "type=Articles |type=2 |type=Images |type=2 |type=Documents |type=2 |type=Definitions |type=2 |type=Community |type=2 |type=Datasets |type=2 |type=Help Pages |type=2 |type=Map Files |type=2"
  • iconSizeSmall (optional, default true) = true or false
  • htmlPrefix (optional, default "Recommendations for you<br>") - for security purposes, this is HTML escaped and thus you can use only text, not HTML
  • ignoreSpecificPage (optional) - case insensitive match, e.g. "Gateway:SOLAR" would match "Gateway:Solar" and not show that as a recommendation; include multiple by defining "ignoreSpecificPage=Gateway:Solar|ignoreSpecificPage=Gateway:Wind"
Dependencies

The Reegle logo.png term extraction API is used in the backend processing of this widget.

Usage

This Widget assumes the existence of HTML elements created by the ContentAssist template, and is called via that template.

{{#Widget:GetRecommendations|element=#recommendationDiv|topic=Solar|randomizeResults=true|iconSizeSmall=true|type=Articles|type=2|type=Map Files|type=3|htmlPrefix=|ignoreSpecificPage=Gateway:Solar|ignoreSpecificPage=Gateway:Wind}}
Example