Not able to get static markdown files via React app in Github Pages

In normal create-react-app React application, I am trying to fetch markdown files inside React app and render it via other packages. Now it’s working locally both in development and production server (build).

After deploying it in Github pages (using gh-pages package), everything is working fine, but only “.md” files are not getting fetched even though it’s there in folder

  1. Build folder to see what all files I have: Link
  2. Fetching markdown file from production link: Link
  3. Fetching random text file: Link

Quick observation, Yes, I can access text file but how can I allow Github pages to serve markdown file as well ?

For future reference in case if links break, I am trying to fetch it like

"DOMAIN"/static/media/random.md # Error 404
"DOMAIN"/static/media/random.txt # Works

EDIT:

I observe, if I add frontmatter key value pair in markdown, then I am no longer able to download the file via
"DOMAIN"/static/media/random.md
But if I remove markdown --- string, then I can download it. Why this behaviour ? How can I overcome this ?

1 Like

Hi @shashank-sharma, welcome to the GitHub Support Community! This could be an issue with GitHub Pages’ default site builder, Jekyll, building your markdown files into HTML files. Can you try disabling Jekyll by creating a file called .nojekyll in the root of your gh-pages branch and see if that makes a difference?

If you’re using a build process to build and deploy your site you may wish to automate the creation of this file during your site’s build process:

"predeploy": "npm run build && touch .nojekyll",

Be aware you may need to tweak this script to position the .nojekyll file in the same directory as your build output to make sure it’s deployed along with your site.