Skip to content

Request support for naming files in other languages #337

Closed

Description

@StringKe

https://github.com/contentlayerdev/contentlayer/blob/main/packages/%40contentlayer/core/src/generation/generate-dotpkg.ts#L389

你好.mdx
&&.mdx

Perhaps it would be useful to use something like the functionality in the transliteration package to support files named in other languages?

I might know why other languages are not supported here, could a config item (fileNmaeTransfrom:(name:string)=>string|Promise<string>) be provided in contentlayer.config.ts to allow the user to handle this?

https://www.npmjs.com/package/transliteration

https://discord.com/channels/872106850928164874/872106850928164878/1045543968110301195

Activity

  1. modified the milestones: Next, Pre-1.0 on Jan 16, 2023
  2. aafnnp commented on Feb 14, 2023

    @aafnnp

    any sample code?

  3. StringKe commented on Feb 14, 2023

    @StringKe
    Author

    any sample code?

    @schickling schickling says he hopes to fix the problem through 'user configuration'.

  4. majiayu000 commented on Feb 25, 2023

    @majiayu000

    any sample code?

    Just create two mdx file in one folder like 你好.mdx and 你好呀.mdx

    It will got redefined error

    Generated 43 documents in .contentlayer
    error - ./.contentlayer/generated/Blog/_index.mjs
    Error:
      x the name `blog__Mdx` is defined multiple times
        ,-[F:\Code\Js\blog\My-blog\.contentlayer\generated\Blog\_index.mjs:39:1]
     39 | import blog__python__PythonMdx from './blog__python__用Python构建区块链.mdx.json' assert { type: 'json' }
     40 | import blog__python__Mdx from './blog__python__量化交易中的地理延迟测试.mdx.json' assert { type: 'json' }
     41 | import blog__rust__rustRustAnalyzerServerMdx from './blog__rust__rust更新和rust-analyzer server安装.mdx.json' assert { type: 'json' }
     42 | import blog__Mdx from './blog__你好.mdx.json' assert { type: 'json' }
        :        ^^^^|^^^^
        :            `-- previous definition of `blog__Mdx` here
     43 | import blog__Mdx from './blog__你好呀.mdx.json' assert { type: 'json' }
        :        ^^^^|^^^^
        :            `-- `blog__Mdx` redefined here
    
  5. modified the milestones: Pre-1.0, 0.3.3 on May 31, 2023
  6. schickling commented on May 31, 2023

    @schickling
    Collaborator

    This should be addressed with the 0.3.3 release. 🎉

  7. kimploo commented on Oct 16, 2023

    @kimploo

    This issue closed helped me a lot too! Thx 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions