├── .gitattributes ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── library.js ├── package.json ├── plugin.json └── templates └── homepage.tpl /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | 217 | 218 | sftp-config.json 219 | 220 | #Node 221 | node_modules/ 222 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | sftp-config.json 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014, psychobunny 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Basic CMS plugin for NodeBB - custom homepage 2 | 3 | Allows you to define a custom homepage for NodeBB. The default template comes with four widget areas (main, sidebar, header, footer). 4 | 5 | ## Screenshots 6 | 7 | ![homepage](http://i.imgur.com/GObRKQq.png) 8 | 9 | ## Instructions 10 | 11 | ### Install 12 | 13 | Command line: 14 | 15 | npm install nodebb-plugin-custom-homepage 16 | 17 | Or install via the Admin Control Panel and restart NodeBB. 18 | 19 | ### Activating 20 | 21 | A new entry will be available under ACP -> General -> Home Page called "Custom Homepage". Set this and hit save. 22 | 23 | ### Adding a menu item to the navbar 24 | 25 | Add a navigation icon to the navbar on the menu via ACP -> General -> Navigation. Under `route`, enter `/`. 26 | -------------------------------------------------------------------------------- /library.js: -------------------------------------------------------------------------------- 1 | (function(module) { 2 | "use strict"; 3 | 4 | var Plugin = {}; 5 | 6 | Plugin.serveHomepage = function(params){ 7 | params.res.render('homepage', { 8 | template: { 9 | name: 'homepage' 10 | } 11 | }); 12 | }; 13 | 14 | Plugin.addListing = function(data, callback){ 15 | data.routes.push({ 16 | route: 'customHP', 17 | name: 'Custom Homepage' 18 | }); 19 | callback(null, data); 20 | }; 21 | 22 | Plugin.defineWidgetAreas = function(areas, callback) { 23 | areas = areas.concat([ 24 | { 25 | 'name': 'Custom HP Header', 26 | 'template': 'homepage.tpl', 27 | 'location': 'hp-header' 28 | }, 29 | { 30 | 'name': 'Custom HP Footer', 31 | 'template': 'homepage.tpl', 32 | 'location': 'hp-footer' 33 | }, 34 | { 35 | 'name': 'Custom HP Sidebar', 36 | 'template': 'homepage.tpl', 37 | 'location': 'hp-sidebar' 38 | }, 39 | { 40 | 'name': 'Custom HP Content', 41 | 'template': 'homepage.tpl', 42 | 'location': 'hp-content' 43 | } 44 | ]); 45 | 46 | callback(null, areas); 47 | }; 48 | 49 | module.exports = Plugin; 50 | }(module)); 51 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodebb-plugin-custom-homepage", 3 | "version": "0.2.3", 4 | "description": "Allows you to define a custom homepage for NodeBB", 5 | "main": "./library.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/psychobunny/nodebb-plugin-custom-homepage" 12 | }, 13 | "keywords": [ 14 | "nodebb", 15 | "plugin", 16 | "badges", 17 | "topic", 18 | "labels" 19 | ], 20 | "author": { 21 | "name": "psychobunny", 22 | "email": "psycho.bunny@hotmail.com" 23 | }, 24 | "nbbpm": { 25 | "compatibility": "^1.6.0" 26 | }, 27 | "license": "BSD-2-Clause", 28 | "bugs": { 29 | "url": "https://github.com/psychobunny/nodebb-plugin-custom-homepage/issues" 30 | }, 31 | "readme": "", 32 | "readmeFilename": "README.md", 33 | "_id": "nodebb-plugin-custom-homepage@0.0.1", 34 | "_from": "nodebb-plugin-custom-homepage@~0.0.1", 35 | "dependencies": { 36 | "validator": "^3.39.0" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "nodebb-plugin-custom-homepage", 3 | "name": "Custom Homepage for NodeBB", 4 | "description": "Allows you to define a custom homepage for NodeBB", 5 | "url": "https://github.com/psychobunny/nodebb-plugin-custom-homepage", 6 | "library": "./library.js", 7 | "hooks": [ 8 | { 9 | "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas" 10 | }, 11 | { 12 | "hook": "action:homepage.get:customHP", "method": "serveHomepage" 13 | }, 14 | { 15 | "hook": "filter:homepage.get", "method": "addListing" 16 | } 17 | ], 18 | "templates": "./templates" 19 | } 20 | -------------------------------------------------------------------------------- /templates/homepage.tpl: -------------------------------------------------------------------------------- 1 |
2 | 3 | {{widgets.hp-header.html}} 4 | 5 |
6 | 7 |
8 |
9 |
10 | 11 | {{widgets.hp-content.html}} 12 | 13 |
14 |
15 |
16 | 17 | {widgets.hp-sidebar.html} 18 | 19 |
20 |
21 | 22 |
23 | 24 | {widgets.hp-footer.html} 25 | 26 |
27 | --------------------------------------------------------------------------------