How to use the @docusaurus/utils.aliasedSitePath 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 / cookbookUtils.js View on Github external
guideFiles.map(async (relativeSource) => {
      const source = path.join(guideDir, relativeSource);
      const aliasedSource = aliasedSitePath(source, siteDir);
      const guideFileName = path.basename(relativeSource);

      const fileString = await fs.readFile(source, 'utf-8');
      const {frontMatter, excerpt} = parseMarkdownString(fileString);

      let date;
      // Extract date and title from filename.
      const match = guideFileName.match(FILENAME_PATTERN);
      let linkName = guideFileName.replace(/\.mdx?$/, '');
      if (match) {
        const [, dateString, name] = match;
        date = new Date(dateString);
        linkName = name;
      }
      // Prefer user-defined date.
      if (frontMatter.date) {
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 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 panjf2000 / gnet / plugins / highlights / highlightUtils.js View on Github external
await Promise.all(highlightFiles.map(async (relativeSource) => {
        const source = path_1.default.join(highlightDir, relativeSource);
        const aliasedSource = utils_1.aliasedSitePath(source, siteDir);
        const fileString = await fs_extra_1.default.readFile(source, 'utf-8');
        const readingStats = reading_time_1.default(fileString);
        const { frontMatter, content, excerpt } = utils_1.parse(fileString);
        const fileName = path_1.default.basename(relativeSource);
        const fileNameMatch = fileName.match(FILENAME_PATTERN);
        if (frontMatter.draft && process.env.NODE_ENV === 'production') {
            return;
        }
        let date = fileNameMatch ? new Date(fileNameMatch[1]) : new Date(Date.now());
        let description = frontMatter.description || excerpt;
        let id = frontMatter.id || frontMatter.title;
        let linkName = relativeSource.replace(/\.mdx?$/, '');
        let tags = frontMatter.tags || [];
        let title = frontMatter.title || linkName;
        highlights.push({
            id: id,
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 / highlightUtils.ts View on Github external
highlightFiles.map(async (relativeSource: string) => {
      const source = path.join(highlightDir, relativeSource);
      const aliasedSource = aliasedSitePath(source, siteDir);
      const fileString = await fs.readFile(source, 'utf-8');
      const readingStats = readingTime(fileString);
      const {frontMatter, content, excerpt} = parse(fileString);
      const fileName = path.basename(relativeSource);
      const fileNameMatch = fileName.match(FILENAME_PATTERN);

      if (frontMatter.draft && process.env.NODE_ENV === 'production') {
        return;
      }

      let date = fileNameMatch ? new Date(fileNameMatch[1]) : new Date(Date.now());
      let description = frontMatter.description || excerpt;
      let id = frontMatter.id || frontMatter.title;
      let linkName = relativeSource.replace(/\.mdx?$/, '');
      let tags = frontMatter.tags || [];
      let title = frontMatter.title || linkName;

@docusaurus/utils

Node utility functions for Docusaurus packages.

MIT
Latest version published 6 days ago

Package Health Score

86 / 100
Full package analysis

Similar packages