Giter Site home page Giter Site logo

mstudio / carbon-for-ibm-dotcom-nextjs-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carbon-design-system/carbon-for-ibm-dotcom-nextjs-template

0.0 0.0 0.0 1.46 MB

This is a NextJS template utilizing Carbon for IBM.com React

License: Apache License 2.0

JavaScript 97.86% Shell 0.35% SCSS 1.78%

carbon-for-ibm-dotcom-nextjs-template's Introduction

Carbon for IBM.com React with Next.js Template

Table of Contents

Overview

This is a Next.js template utilizing Carbon for IBM.com React, deploying a vanilla instance of Next.js with the DotcomShell, along with other various patterns and components available in Carbon for IBM.com.

Getting Started

Get the code by cloning this repo using git

git clone https://github.com/carbon-design-system/carbon-for-ibm-dotcom-nextjs-template.git

Once cloned, go to the project directory to install dependencies and build the project

$ yarn && yarn build

In order to enable features like Right-to-Left (RTL), you will have to set environment variables in a .env file. Please see .env.example.

BASE_PATH=<Sets the base directory for urls and assets, default is '' >
ALTLANG_ROOT_PATH=<Sets the root path for language alternative urls, default is '/' >
ENABLE_RTL=<Boolean to enable RTL for the page, eg. false >
SASS_PATH=node_modules:src

Then start the application:

$ yarn dev

To export to a static site, run the following:

$ yarn build-export

Then the contents of the out folder can be uploaded to your production environment.

SASS compilation and carbon-components

There may be times pathing errors are encountered when importing certain stylesheets (like carbon-components). We're working hard to fix these, but in the meantime you can add the following to your .env file to resolve:

SASS_PATH=node_modules:src

Note: For Windows, the syntax is slightly different

SASS_PATH=./node_modules;./src

Right-to-Left (RTL)

Right-to-left rendering is supported, to enable set the ENABLE_RTL environment variable to true.

Things to Note

If building an IBM.com page, there are items that need to be included which can be viewed here: Building for IBM.com

Page Language

This template handles page language functionality, where the available languages are defined in components/data/altlang.json. The Altlangs component then generates all alternate links to be injected into the <head> element.

Digital Data Object

The Digital Data Object (DDO) is a flexible, customizable collection of metadata that also provides tools and services such as live chat and analytics to page authors. You can find more details on Building for IBM.com.

The template has a placeholder DDO you can define located in `pages/data/DDO.json. Example values shown below:

<script>
  digitalData = {
    page: {
        category: {
            primaryCategory: '' // e.g. SB03
        },
        pageInfo: {
            effectiveDate: '', // e.g. 2014-11-19
            expiryDate: '', // e.g. 2017-11-19
            language: '', // e.g. en-US
            publishDate: '', // e.g. 2014-11-19
            publisher: '', // e.g. IBM Corporation
            version: 'Carbon for IBM.com',
            ibm: {
                contentDelivery: '', // e.g. ECM/Filegen
                contentProducer: '', // e.g. ECM/IConS Adopter 34 - GS83J2343G3H3ERG - 11/19/2014 05:14:02 PM
                country: '', // e.g. US
                industry: '', // e.g. B,U
                owner: '', // e.g. Some Person/City/IBM
                siteID: '', // e.g. MySiteID
                subject: '', // e.g. SW492
                type: '' // e.g CT305
            }
        }
    }
  };
</script>

Meta Tags and Analytics

The template already renders the required meta tags and IBM.com analytics script that are required for IBM.com websites. They are located in pages/_app.js.These can be adjusted/removed to fit your project and needs.

Meta Tags:

<meta charset="UTF-8" />

<link rel="icon" href="//www.ibm.com/favicon.ico" />

<meta name="dcterms.date" content="YYYY-MM-DD" />
<meta name="dcterms.rights" content="© Copyright IBM Corp. 2016" />
<meta name="geo.country" content="US" />
<meta name="robots" content="index,follow" />

IBM.com Tag Management and Site Analytics Script

<!-- IBM Tag Management and Site Analytics -->
<script src="//1.www.s81c.com/common/stats/ibm-common.js" defer></script>

Upgrading from the Template

To pull latest changes from the Carbon for IBM.com NextJS template, this repo can be added as a remote to your application repository:

git remote add template https://github.com/carbon-design-system/carbon-for-ibm-dotcom-nextjs-template.git

Then run git fetch to update the changes:

git fetch --all

And finally merge changes in:

git merge template/master

carbon-for-ibm-dotcom-nextjs-template's People

Contributors

annawen1 avatar dependabot[bot] avatar guilhermelmoraes avatar ibmdotcom-bot avatar ignaciobecerra avatar jeffchew avatar kennylam avatar kodiakhq[bot] avatar mstudio avatar raphaelamadeu-zz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.