content icon indicating copy to clipboard operation
content copied to clipboard

<ContentDoc /> component path property must be lower letter

Open lxxaisy opened this issue 1 year ago • 6 comments

Environment


  • Operating System: Darwin
  • Node Version: v16.14.2
  • Nuxt Version: 3.6.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.7.2
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, build, devtools, content
  • Runtime Modules: @nuxtjs/[email protected], @nuxt/[email protected]
  • Build Modules: -

Reproduction

WX20231123-191625@2x WX20231123-191637@2x

the first screenshot is the code.the second is the web show. clearly if the route.path is lower letter it works.

Describe the bug

WX20231123-190833@2x

like the screenshot, the $route.path is "codepenio/easyComSlider". but when i use <ContentDoc /> in the pages/codepenio/easyComSlider.vue can not render the markdown file. when i add path "codepenio/easycomslider" it works. according to the article,default path is the $route.path. is the path lower letter is neccessary.

please forgive my terrible english.

Additional context

No response

Logs

No response

lxxaisy avatar Nov 23 '23 11:11 lxxaisy

Although the case of URLs does not affect URL resolution in most cases, it is generally recommended to use lowercase and separate each word with a hyphen (-) for SEO purposes. For example, codepenio/easyComSlider is recommended to be changed to codepenio/easy-com-slider. This is because the URL easyComSlider is easily parsed as ONE word instead of three words.

雖然URL的大小寫在多數狀況下不影響網址解析。但就SEO的角度來看,通常建議使用小寫,並將各個單字用-隔開。例如 codepenio/easyComSlider ,建議改成 codepenio/easy-com-slider。這是因為easyComSlider容易被解析成一個字,而非三個字。

AssetCEO avatar Nov 27 '23 16:11 AssetCEO

Thank you for the comment and the recommend.But the documentation about ContentDoc confused me.The path default value is the $route.path,but when it is not the lower letter,it will not work.

lxxaisy avatar Nov 28 '23 01:11 lxxaisy

I agree with your point. Perhaps the official documentation should remind users about this issue, or update the path parsing logic. However, I would recommend the former, for SEO purposes.

AssetCEO avatar Nov 28 '23 04:11 AssetCEO

Thank you again and I will follow your recommend.

lxxaisy avatar Nov 28 '23 05:11 lxxaisy

I have the same issue with resolving the path in queryContent(). It doesnt work if capital letters appear in the path. If this is a desired behavior, it should be mentioned in the documentation and also in the migration guide, as it still worked with capital letters in the old version of nuxt-content.

dominik-kuhn avatar Feb 12 '24 11:02 dominik-kuhn

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Aug 20 '24 01:08 github-actions[bot]