DotCMS provides an Angular example that shows how to build dotCMS pages heedlessly with Angular JavaScript framework.
- A dotCMS instance or you can use https://demo.dotcms.com
- Node.js and npm installed
- Terminal
- And a code editor.
Get the code from the next directory
https://github.com/dotCMS/core/tree/master/examples/angular
Now we need to tell the Angular app what dotCMS instance is going to use to get the data to build its pages.
- Open the folder
YOUR_NAME
in your code editor - Go to
src/environments
- Open the
environment.development.ts
file and update the environment variable:
authToken
this is the auth token for dotCMS, you can use the dotCMS UI to create one.dotcmsUrl
this is the instance of dotCMS where your pages and content lives (license needed) if you don’t have one, you can use https://demo.dotcms.com (be careful it restarts every 24h)
Once all the configuration is in place, it is time to run the web app.
- Go back to your terminal and from the folder YOUR_NAME
- Run
ng serve
- Open http://localhost:3000 in your browser
🎉 And that’s it.
Consider that if you go to localhost:4200/about
, the page /about
needs to exist in your dotCMS instance.
In dotCMS, Vanity URLs serve as alternative reference paths to internal or external URLs. They are simple yet powerful tools that can significantly aid in site maintenance and SEO.
Next.js is a robust framework that provides the capability to handle vanity URLs. It allows you to redirect or forward users to the appropriate content based on predefined logic. You can seamlessly integrate this feature of Next.js with dotCMS. For an implementation example, refer to this link.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.