Web Panel
Web panels can be used to add HTML snippets to parts of a page. They could be used to display additional information on a particular build, a plan, or the system navigation. For more information, read up on web panels in the Atlassian documentation.
Examples
Deprecated Space Notification
You can inform editors that a certain Confluence space will be deprecated, so they should update a page in another space.
Choose the Show a Web Panel fragment.
Fill out the form:
The weight field is optional, and it only takes positive integers. Lower integers make the panel appear at the top of the section. If the field is blank, appears at the end of the section.
Add a condition to restrict the web panel to a specific space by its name:
groovycontext.space.name == "Demonstration Space"
Add the following code to the Provider Class/Script field:
writer.write("<div style='background-color: yellow; text-align: center'>" + "This space is going to be deprecrated. Please move" + " all content to the DOCS space</div>")
The results of the above web panel look like this:
You must write to the provided writer
object not just return a string
.
Conditions
Conditions are largely the same as for web item conditions.