Let a template page have an optional icon.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / page / TemplatePage.java
index e483aa3..79dd208 100644 (file)
@@ -90,6 +90,10 @@ public class TemplatePage implements Page, LinkEnabledCallback {
                for (String styleSheet : getStyleSheets()) {
                        pageNode.addCustomStyleSheet(styleSheet);
                }
+               String shortcutIcon = getShortcutIcon();
+               if (shortcutIcon != null) {
+                       pageNode.addForwardLink("icon", shortcutIcon);
+               }
 
                try {
                        processTemplate(request, template);
@@ -115,6 +119,15 @@ public class TemplatePage implements Page, LinkEnabledCallback {
        }
 
        /**
+        * Returns the name of the shortcut icon to include in the page’s header.
+        *
+        * @return The URL of the shortcut icon, or {@code null} for no icon
+        */
+       protected String getShortcutIcon() {
+               return null;
+       }
+
+       /**
         * Can be overridden when extending classes need to set variables in the
         * template before it is rendered.
         *