1.6.11 • Published 2 years ago

@kjam/next v1.6.11

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

@kjam/next

Client within the kjam tooling for git (github) based headless CMS + next.js projects.

Usage

In kjam.js

module.exports = require("@kjam/next/config").withKjam({
  i18n: {
    locales: ["it", "en"],
    defaultLocale: "it",
  },
  // any Next.js and/or kjam configuration option
});

In next.config.js

const withNx = require("@nrwl/next/plugins/with-nx");
const withTranslate = require("next-translate");

let nextConfig = require("./kjam").nextConfig;

nextConfig = withTranslate(nextConfig);
nextConfig = withNx(nextConfig);

module.exports = nextConfig;

In i18n.js

module.exports = require("./kjam").translateConfig({
  // any next-translate configuration option
  pages: {
    '*': ['_', '~'],
  },
};

In one of your pages, e.g. pages/[slug].ts

import { kjam, KjamProps } from "@kjam/next";
import { PageDebug } from "@kjam/next-ui";
// import { mdComponents } from "../md-components";

type Data = {
  title: string;
};

type Params = {
  slug: string[];
};

type Props = KjamProps<Data, Params> & {};

export default function PagesPage({
  mdx,
  entry,
}: PageStatic<typeof getStaticProps>) {
  return (
    <PageDebug
      tpl="[slug]"
      entry={entry}
      mdx={mdx}
      // mdComponents={mdComponents}
    />
  );
}

export const getStaticPaths: DataStaticPaths<Params> = async (ctx) => {
  return await kjam.getStaticPaths<Params>(ctx, "blocking", "pages");
};

export const getStaticProps: DataStatic<Props, Params> = async (ctx) => {
  return await kjam.getStaticProps<Params, Data>(ctx, "");
};

This repo is automatically deployed by @kjam monorepo. Issues and development happen there.

1.6.11

2 years ago

1.6.10

2 years ago

1.6.9

2 years ago

1.6.8

2 years ago

1.6.7

2 years ago

1.6.6

2 years ago

1.6.4

2 years ago

1.6.3

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.6.5

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.26

2 years ago

1.4.24

2 years ago

1.4.23

2 years ago

1.4.21

2 years ago

1.4.19

2 years ago

1.4.18

2 years ago

1.4.17

2 years ago

1.4.16

2 years ago

1.4.15

2 years ago

1.4.14

2 years ago

1.4.13

2 years ago

1.4.12

2 years ago

1.4.11

2 years ago

1.4.10

2 years ago

1.4.9

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

0.0.1

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago