Source code for the Acoustic Content (formerly Watson Content Hub) starter site application - Oslo.
This github repository contains all the source code files like javascript, css and html but not the Oslo artifacts like pages, content types, categories, and content. Content tenants created after September 18th 2017 will have the Oslo artifacts automatically deployed. For older tenants you need to manually deploy the artifacts by downloading the Oslo built artifacts from the home page of your tenant from the "Update the sample site" widget. Not sure if you have the Oslo artifacts?
You can compare the Build date with the date shown in the "Update the sample site" widget on the Home page to see if your deployed sample is older than the latest sample code. Instructions on how to update Oslo to the latest can be found here: Updating your Oslo sample.
At the end of August 2019 we have updated the Oslo starter site with the following features:
At the end of July 2019 we have updated the Oslo starter site with the following features:
At the beginning of January 2019 we have updated the Oslo starter site with the following features:
At the beginning of December 2018 we have updated the Oslo starter site with the following features:
At the end of October 2018 we have updated the Oslo starter site with the following features:
At the beginning of September 2018 we have updated the Oslo starter site with the following features:
At the beginning of August 2018 we have updated the Oslo starter site with the following features:
At the beginning of June 2018 we have updated the Oslo starter site with the following features:
At the end of May 2018 we have updated the Oslo starter site with the following features:
At the end of April 2018 we have updated the Oslo starter site with the following features:
At the end of March 2018 we have updated the Oslo starter site with the following features:
At the end of February 2018 we have updated the Oslo starter site with the following features:
At the beginning of February 2018 we have updated the Oslo starter site with the following features:
At the beginning of January 2018 we have updated the Oslo starter site with the following features:
At the beginning of December 2017 we have updated the Oslo starter site with the following features:
From your cli make sure to install project dependencies by running npm install
You can set the tenant information, by changing the values in src/app/Constants.ts
.
This file determines from which tenant site and layout information gets served
from.
Inside src/app/Constants.ts
, uncomment these three lines and replace the values:
// static readonly DOMAIN_NAME = 'your-domain-name.com';
// static readonly CONTENT_HUB_ID = '0000000-0000-0000-0000-000000000000';
// static readonly SITE_ID = '00000000-0000-0000-0000-000000000000';
Steps to retrieve the delivery URL for a site:
Run npm start
for a dev server. Navigate to http://localhost:4200/
. The app
will automatically reload if you change any of the source files.
Use the npm run start-dev-tools
command to load the developer tools UI. Read more here.
Run npm run build
to build the project. The build artifacts will be stored in
the assets/
directory. Use the -prod
flag for a production build.
Run npm run deploy
to deploy the built code to Watson Content Hub. There is also a shortcut for building and deploying in one step via npm run build-deploy
. Note that publishing can take up to 20 minutes for all updates to be available.
In case you do not want to wait for the server side akamai cache to time out you can flush the cache via:
wchtools clear --cache
More information can be found here: Clearing the content delivery network cache
See the included detailed documentation on running tests Running unit tests and end-to-end tests .
The Oslo site provides scripting to ease the process of importing 3rd party components.
We have provided a set of sample component repositories:
sample-active-site-components
project/zip, you can find the content-artifacts
directory and the site-application-files
directory.content-artifacts
directory contains content/pages required for the components in addition to the layout and layout-mappings files. The directory follows the WCH directory structure. /catagories
stores assests in "Taxonomies". /content
stores assests in "Content". /types
stores content types. /site
stores Oslo's pages' setting. /layouts
and /layout-mappings
store all layout settings created when you run npm run create-layout
. You could find them in WCH by their "id" or "name" in json files after you deploy them into the tenant.site-application-files
stores HTML/CSS/TS files needed for the sample components. You can customize the components by editing files in site-application-files/src/app/layouts/<COMPONENT NAME>
.See the readme of sample-active-site-components for details: https://github.com/ibm-wch/sample-active-site-components
The SPA will now use HTML5 style URLs and routing.
To use code scaffolding you will want the Angular CLI with this project. To
install it globally run npm install -g @angular/cli
.
Run ng generate component component-name
to generate a new component. You can
also use ng generate directive|pipe|service|class|module
.
The SPA uses the ng2-logger package for logging. By default logging will be enabled when running locally and disabled when running in production mode on the tenant. The logging level can be changed by setting a cookie in the browser.
The available log levels are
Setting the logging level will result in a waterfall effect, for example if setting warn
logging will also be enabled for error
and data
.
To change the logging level you can enter the following into the browsers console developer tools
document.cookie = 'wch.sites.logging.level=warn'
To make it easier to remove the default Oslo site either completely or just the out of the box images, content, pages and assets, we created two sample manifest files, oslo-complete.json
and oslo-sample-artifacts.json
for the Oslo site. With these two manifest files, you can easily push and delete your Oslo contents listed in the manifest file with wchtools.
oslo-complete.json
contains all Oslo code (web assets) and sample site content.oslo-sample-artifacts.json
is a subset of oslo-complete.json. This manifest contains only the site assets, renditions, contents and pages. The manifest does not contain the source code, layouts, layout-mappings, content types, image-profiles, categories, and basic rendering functions.oslo-minimum.json
contains minimum reusable artifacts that can be used to create your own SPA site. This manifest contains only source code, layouts, layout-mappings, content types, image-profiles, categories, generic components (header and footer), and generic page (404 error page)To push, pull, and delete content by manifest, please refer to: https://github.com/ibm-wch/wchtools-cli#pushing-pulling-and-deleting-by-manifest
If you want to start with a new site skeleton without all of the Oslo artifacts that are not required you can delete the extra artifacts with the oslo-sample-artifacts
manifest. The deletion will not remove referenced items in Oslo that are not part of the manifest. So, if you created content or other items that are using Oslo content types, content, or assets, these will not be removed by the delete command.
Note: Since the sample manifest files only work for the default Oslo starter site template, if you add new content to your site, you have to create your own manifest files. Details: https://github.com/ibm-wch/wchtools-cli#creating-a-new-manifest
wchtools delete -A -v --server-manifest oslo-sample-artifacts
wchtools delete -A -v --server-manifest oslo-complete
oslo-complete.json
after adding your customized content in your tenant:wchtools pull -A -v
wchtools list -A --write-manifest oslo-complete
wchtools push -w -v -f --path /dxconfig/manifests/
wchtools init
wchtools push -A -v -f --manifest oslo-minimum
Note: If you have older site in your tenant, you have to delete it first before pushing the Oslo minimum template. wchtools delete -A -v --all
would be helpful if you want to clean up your tenant.
Different styles can be applied to the application, depending on which site is loaded. To configure your site with custom styles, follow these following steps:
src/oob-spa/styles
directory..scss
file, where the file name matches the site ID that you want to customize (e.g. <site-id>.scss
)..scss
file.angular.json
file at the root directory, update the styles
property, adding your new style as an object with these properties and values:{
...
"projects":{
"wch-site-application": {
"architect": {
"build": {
...
"options": {
...
"styles": [
"src/styles.css",
// start new style configuration
{
"input": "src/oob-spa/styles/<site-id>.scss",
"lazy": true,
"bundleName": "oob-spa/styles/<site-id>"
}
// end new style configuration
],
...
},
...
},
...
},
...
},
...
},
...
}
That's it! Now, any styles that are added to <site-id>.scss
will be applied to the SPA, when rendering the site with a matching ID. You can preview your style changes by running npm start
to view the preview server. When ready, you can deploy the changes to the tenant by running npm run build-deploy
See the included license file License .
Acoustic Content developer documentation: https://developer.goacoustic.com/acoustic-content/docs
Acoustic Content API reference documentation: https://developer.goacoustic.com/acoustic-content/reference
Acoustic Content Samples Gallery: https://content-samples.goacoustic.com/