How to use the @docusaurus/utils.docuHash function in @docusaurus/utils

To help you get started, we’ve selected a few @docusaurus/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Jeffail / benthos / website / src / plugins / cookbooks / index.js View on Github external
guidePosts.map(async guidePost => {
          const {metadata} = guidePost;
          await createData(
            // Note that this created data path must be in sync with metadataPath provided to mdx-loader
            `${docuHash(metadata.source)}.json`,
            JSON.stringify(metadata, null, 2),
          );

          addRoute({
            path: metadata.permalink,
            component: guidePostComponent,
            exact: true,
            modules: {
              content: metadata.source,
            },
          });
        }),
      );
github panjf2000 / gnet / plugins / highlights / index.ts View on Github external
highlights.map(async highlight => {
          const {metadata} = highlight;
          await createData(
            // Note that this created data path must be in sync with
            // metadataPath provided to mdx-loader.
            `${docuHash(metadata.source)}.json`,
            JSON.stringify(metadata, null, 2),
          );

          addRoute({
            path: metadata.permalink,
            component: highlightComponent,
            exact: true,
            modules: {
              content: metadata.source,
            },
          });
        }),
      );
github panjf2000 / gnet / plugins / highlights / index.js View on Github external
await Promise.all(highlights.map(async (highlight) => {
                const { metadata } = highlight;
                await createData(
                // Note that this created data path must be in sync with
                // metadataPath provided to mdx-loader.
                `${utils_1.docuHash(metadata.source)}.json`, JSON.stringify(metadata, null, 2));
                addRoute({
                    path: metadata.permalink,
                    component: highlightComponent,
                    exact: true,
                    modules: {
                        content: metadata.source,
                    },
                });
            }));
        },
github panjf2000 / gnet / plugins / highlights / index.ts View on Github external
metadataPath: (mdxPath: string) => {
                      const aliasedSource = aliasedSitePath(mdxPath, siteDir);
                      return path.join(
                        dataDir,
                        `${docuHash(aliasedSource)}.json`,
                      );
                    },
                  },
github Jeffail / benthos / website / src / plugins / redirects / index.js View on Github external
redirects.map(async redirect => {
          const dest = JSON.stringify({to: redirect[1], forComponent: redirect[2]});
          const destPath = await createData(`${docuHash(redirect[0])}.json`, dest);

          addRoute({
            path: redirect[0],
            component: '@site/src/exports/redirect.js',
            modules: {
              dest: destPath,
            },
            exact: true,
          });
        }),
      );
github panjf2000 / gnet / plugins / highlights / index.ts View on Github external
Object.keys(highlightTags).map(async tag => {
          const {name, items, permalink} = highlightTags[tag];

          tagsModule[tag] = {
            allTagsPath: tagsPath,
            slug: tag,
            name,
            count: items.length,
            permalink,
          };

          const tagsMetadataPath = await createData(
            `${docuHash(permalink)}.json`,
            JSON.stringify(tagsModule[tag], null, 2),
          );

          addRoute({
            path: permalink,
            component: highlightTagComponent,
            exact: true,
            modules: {
              items: items.map(highlightID => {
                const metadata = highlightItemsToMetadata[highlightID];
                return {
                  content: {
                    __import: true,
                    path: metadata.source,
                    query: {
                      truncated: true,
github panjf2000 / gnet / plugins / highlights / index.js View on Github external
metadataPath: (mdxPath) => {
                                            const aliasedSource = utils_1.aliasedSitePath(mdxPath, siteDir);
                                            return path_1.default.join(dataDir, `${utils_1.docuHash(aliasedSource)}.json`);
                                        },
                                    },
github Jeffail / benthos / website / src / plugins / cookbooks / index.js View on Github external
metadataPath: (mdxPath) => {
                      const aliasedPath = aliasedSitePath(mdxPath, siteDir);
                      return path.join(
                        dataDir,
                        `${docuHash(aliasedPath)}.json`,
                      );
                    },
                  },
github panjf2000 / gnet / plugins / highlights / index.js View on Github external
await Promise.all(Object.keys(highlightTags).map(async (tag) => {
                const { name, items, permalink } = highlightTags[tag];
                tagsModule[tag] = {
                    allTagsPath: tagsPath,
                    slug: tag,
                    name,
                    count: items.length,
                    permalink,
                };
                const tagsMetadataPath = await createData(`${utils_1.docuHash(permalink)}.json`, JSON.stringify(tagsModule[tag], null, 2));
                addRoute({
                    path: permalink,
                    component: highlightTagComponent,
                    exact: true,
                    modules: {
                        items: items.map(highlightID => {
                            const metadata = highlightItemsToMetadata[highlightID];
                            return {
                                content: {
                                    __import: true,
                                    path: metadata.source,
                                    query: {
                                        truncated: true,
                                    },
                                },
                            };

@docusaurus/utils

Node utility functions for Docusaurus packages.

MIT
Latest version published 30 days ago

Package Health Score

92 / 100
Full package analysis

Similar packages