Salted Herring's Knowledge Hub module
Step 0 If you don't want to use AddThis sharing buttons, you may skip this. Otherwise. follow.
Go to https://www.addthis.com/, get your sharing code ready. All you need is the pubid that you are given: e.g.:
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-123456sb7984a61d"></script>
What you need is ra-123456sb7984a61d
Now go to config.yml
, place this like
AddThis:
PUBID: 'ra-123456sb7984a61d'
Do your flush, and move one to the next step
Step 1 Because this module isn’t public, you will need to make changes in composer.json to be able to access to it:
"repositories": [
{
"type": "vcs",
"url": "[email protected]:salted-herring/salted-knowledge-hub.git"
}
]
"require": {
…
"salted-herring/salted-knowledge-hub": "dev-master”,
…
And then you run composer update
Once the installation is done, do dev/build?flush=all
on the browser
Step 2
To give support to the frontend, you also need below JS libraries installed. Please add them into your bower’s dependencies
block, and then run bower update
"salted-js": "*",
"handlebars": "^4.0.10",
"fancySelect": "fancyselect#^1.1.0",
"isotope": "^3.0.4",
"isotope-packery": "^2.0.0",
"imagesloaded": "^4.1.3"
Step 3
Now go to mainsite/code/Page.php
file, find init
function, and add below code accordingly
$combined_file = 'scripts.js';
Requirements::combine_files(
$combined_file,
array(
...
'themes/default/js/components/salted-js/dist/salted-js.min.js',
'themes/default/js/components/fancySelect/fancySelect.js',
'themes/default/js/components/isotope/dist/isotope.pkgd.min.js',
'themes/default/js/components/isotope-packery/packery-mode.pkgd.min.js',
'themes/default/js/components/imagesloaded/imagesloaded.pkgd.min.js',
...
)
);
$this->KnowledgeHubJSinit($combined_file);
Step 4
… Almost there — now open themes/[theme_name]/templates/Page.ss
file, and add below line before the </head>
tag:
<script src="/$themeDir/js/components/handlebars/handlebars.min.js"></script>
The reason we have to include Handlebars’ library separately, because when we switch the site to Live mode, it will complain - seems Handlebars have a very picky lifestyle :/
All your articles need to extend: KnowledgeArticle
, and then do your fancy stuff from there.
The page hierarchy is like this:
Knowledge Hub Landing Page
|-Knowledge Hub Group Page A
|-Knowledge Article Page 1
|-Knowledge Article Page 2
|-Knowledge Article Page 3
|-Knowledge Hub Group Page B
|-Knowledge Article Page 4
|-Knowledge Article Page 5
|-Knowledge Article Page 6
There is a possible gotcha after a Knowledge Hub Group page is created: After the page is created, you won’t see the Child Page tab straightaway. You need to open up the right sidebar (assume it’s closed), and select the article types that you are going to allow in this particular group
Oh by the way, the right sidebar in Knowledge Hub Group Page editing interface is also where you define how many items per page
This module leaves the canvas blank for your awesome painting to take place. If you find the default templates trip you, just feel free to override them