Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Blog-only" configuration with alpha.72 #4567

Closed
christophemenager opened this issue Apr 3, 2021 · 1 comment · Fixed by #4575
Closed

"Blog-only" configuration with alpha.72 #4567

christophemenager opened this issue Apr 3, 2021 · 1 comment · Fixed by #4575
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@christophemenager
Copy link

christophemenager commented Apr 3, 2021

First of all, thanks for the amazing work on this project ! 👍

Source code : https://github.com/christophemenager/christophem-blog
Blog in production : https://chrichri.netlify.app/

I am running a "blog only" version of docusaurus and I followed the documentation here without any issue, it works like a charm BUT :

The newly released i18n feature does not work (I followed the documentation about the setup precisely)

  1. The default locale is perfectly fine
  2. When trying to access www.my-personal-blog/en, I see a 404 error. https://chrichri.netlify.app/en/

Ideas
I suspect it's because there is no index.js in a "blog-only" configuration and maybe docusaurus is trying to find such a file ?

The JSX in markdown does not work when importing a component declared in an other file

  1. I created a custom component in src/components/PhoneView.tsx https://github.com/christophemenager/christophem-blog/blob/main/src/components/PhoneView.tsx
  2. I imported it from an mdx file in 2021-04-05-scrollview-style.mdx with import {PhoneView} from '../src/components/PhoneView.tsx' and use it in the blog post <PhoneView /> https://github.com/christophemenager/christophem-blog/blob/main/blog/2021-04-05-scrollview-style.mdx
  3. I see a blank screen after reloading the page, absolutely nothing appears

Ideas
If I copy/paste the content of PhoneView.tsx directly in the blog post, it works. It's as if declaring a component in an other file than the mdx file was breaking something.
I tried many thing :

  1. Not using typescript but plain js
  2. Declaring my component file in an other location that src
  3. Using absolute path for importing
  4. Using default export
@christophemenager christophemenager added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Apr 3, 2021
@christophemenager christophemenager changed the title Blog only configuration with alpha.72 "Blog-only" configuration with alpha.72 Apr 4, 2021
@slorber
Copy link
Collaborator

slorber commented Apr 5, 2021

Thanks, this is indeed a bug due to a typo, that I just fixed in #4575

The build process was sensitive to the order in which the user provides the locales, and thought it had reached the last locale to build of the list. In the end, Docusaurus just builds your site in "fr" and never in "en"

Temporary workaround: put the default locale first in the list:

  i18n: {
    defaultLocale: 'fr',
    locales: ['fr', 'en'],
    localeConfigs: {
      en: {
        label: 'English',
      },
      fr: {
        label: 'Français',
      },
    },
  },

@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
3 participants