Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
Add code example in JS as intro
Browse files Browse the repository at this point in the history
  • Loading branch information
Bellfalasch committed Jun 11, 2018
1 parent 200306a commit 3c23845
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions doc/developer/site/contributions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@ Added code from page contributions will be aggregated from all controllers befor

To use page contributions, your component needs to return a ``pageContributions`` property in the response of your component, meaning in the returned JavaScript object (where you usually put the ``body`` property). A full return might look like this. As always, the ``return`` goes at the end of your component's controller.

```
return {
body: '<p>Some code</p>',
pageContributions: {
headEnd: "<script>My script</script>"
}
}
```
.. literalinclude:: code/page-contribution-intro.js
:language: javascript

Changing the ``headEnd`` to one of the other possible positions will change where the code you contributed is added in the page's HTML before returning it to the end-user.

Expand Down

0 comments on commit 3c23845

Please sign in to comment.