How to use plugin-custom-homepage??
-
Hi all,
I wonder if anyone has previously used nodebb-plugin-custom-homepage before?
It is not working somehow and I looked into the implementing logic for it. It re-route the
/
to a new rendering logic defined within the plugin calledrenderHomepage
and in that function it calledres.render('homepage', {})
.As far as I see, it does put the template file under public/template folder. However,
{widgets.html}
seems not getting the corresponding value and somehow all the widget element was attached a class called 'hidden', which I guess is because it doesn't get the widget value?For one more thing I would also willing to know is how does the single page application logic wired up? Because this plugin does override the initial HTTP request. However, if you click the logo later on, it still does the default action, which render the forum and ruin the purpose for the plugin.
I really appreciate if someone can help me with it.
PS: By the way, the original plugin does a little bug, so you need to change
app.get('/', params.middleware.buildHeader, renderHomepage);
toapp.route('/').get(params.middleware.buildHeader, renderHomepage);
. Because express will take the action as soon as it find out a matching route and stop further search for the following route. As we are trying to override the original action, I use route to get the original object and re-route it for the new action. -
Hi,
@yeelan0319 I was playing around with this plugin too.
Once installed in Administracion Control Panel if you go to the option: ADMIN CONTROL PANEL > EXTEND WIDGETS
in widget areas will appear "homepage.tpl". Placing elements on that view, will make them to appear in the custom homepage.