Source code for the Watson Content Hub starter site application - Oslo.
- A WCH tenant in Trial or Standard Tier
- Node.js v6.11.1 or above Note: We recommend to run npm install after getting the latest from this repository to get the latest prerequisites.
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. WCH 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?
- Log in to your tenant and go to the Website menu and check if Oslo is rendering in the preview window.
- Check SDK and SPA build levels from the browser
- Open the dev console
- Search for 'Build date' to get the current SPA level
- Search for 'SDK version' to get the SDK version included in the SPA
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.
- Roadmap for developing your own site
- Site structure (Content model-How the sample site is built)
- Programming Model
- Watson Content Hub - Sites Development Overview
- Customizing the sample website
- Resources
- Updating your Oslo sample
At the end of March we have updated the Oslo starter site with the following features:
- performance improvements - reducing the size of the generated scripts
- Added support for script applications
At the end of February we have updated the Oslo starter site with the following features:
- upgrade to Angular 5.2
- leveraging ng build versus separate webpack
- bug fixes and performance improvements
At the beginning of February we have updated the Oslo starter site with the following features:
- added inline editing for links
- bug fixes and performance improvements
- also check out our new HTML snippet sample here: https://github.com/ibm-wch/sample-html-snippet
At the beginning of January we have updated the Oslo starter site with the following features:
- update of Angular to Angular 4.4.6
- Introduced a new search component and added search of pages to the functionality - results are displayed on the new search page
- Introduced the ability to hide pages from the navigation while still available via URL with a new flag that can be set in the page
- Enhanced Inline Editing support
At the beginning of December we have updated the Oslo starter site with the following features:
- Performance improvements
- bug fixes
- Support for Google crawling of a given page in Oslo (more features planned in this area)
- Additional layouts for the Standard page type
- Removal of # from the URLs and now leveraging HTML 5 mode for URLs (i.e. https://myhost/design-topics/clean-design)
- Enablement for Inline Editing in the Sites Composer
- Ability to leverage Angular 5 instead of Angular 4
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.
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.
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.
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:
- At the root of the
sample-active-site-components
project/zip, you can find thecontent-artifacts
directory and thesite-application-files
directory. - The
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 runnpm run create-layout
. You could find them in WCH by their "id" or "name" in json files after you deploy them into the tenant. - The
site-application-files
stores HTML/CSS/TS files needed for the sample components. You can customize the components by editing files insite-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
- info
- warn
- error
- data
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'
Find more details on the WCH development environment, technical documentation, sample applications, APIs and other information to jumpstart your development project.
See the included license file License .