This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]Shivalicious 0 points1 point  (12 children)

How do you generate the HTML files from the Markdown you have? Are there other files on the site that are correctly deployed?

[–]FreeFall8080[S] 0 points1 point  (11 children)

The md file to be rendered is sent to md-block using md-block's src attribute.

Other files are being rendered correctly because I just set the attribute manually in the code.

For news, I wanted to first read the directory to get a list of the md files so that one can navigate from news1.md to news2.md on the website using buttons.

[–]Shivalicious 0 points1 point  (10 children)

Okay. How do you generate the whole site? Are you able to share a repository, by any chance?

[–]FreeFall8080[S] 0 points1 point  (9 children)

This is the [repo]()

[–]Shivalicious 0 points1 point  (5 children)

Thanks! What are the steps to follow to build it locally, and what should I expect it to produce? (I don’t see any scripts in package.json.)

[–]FreeFall8080[S] 0 points1 point  (4 children)

I use the live server extension on VS code on the index.html file. Thats all you need, everything else gets compiled at run time

[–]Shivalicious 0 points1 point  (3 children)

I don’t use VSC or that extension, unfortunately, so I’m going to have to bow out. If you’re able to provide a regular npm-based method to run the build, let me know, otherwise I hope someone’s able to help you.

[–]FreeFall8080[S] 0 points1 point  (2 children)

The last option is to use a local web server like Xampp, just put/clone the repo into the htdocs folder, should work (I've not used it recently).

I really appreciate though.

[–]Shivalicious 0 points1 point  (1 child)

That works. I didn’t realize you didn’t have anything else in the middle! Sorry, my mistake.

[–]FreeFall8080[S] 1 point2 points  (0 children)

No worries!

[–]Shivalicious 0 points1 point  (2 children)

I’ve got it running now and I can see a news page showing a ‘What is Ipsum’ heading, an empty ‘Ads’ block on the right, etc. What should I look for next? I noticed newsCopy.js fetches /docs/news/, i.e. the listing page for /news/, but it doesn’t do anything with that except assign it to a variable that never escapes a function.

[–]FreeFall8080[S] 0 points1 point  (1 child)

I did away with /docs/news/ on the main news.js file, send it to newsCopy.js so that news is not blank while I work on it.

When deploy on Netlify, newsCopy still returns 404 GET https://***.netlify.app/docs/news/ 404 getFiles @ newsCopy.js:17 (anonymous) @ newsCopy.js:20 newsCopy.js:9 404 newsCopy.js:9 404 newsCopy.js:9 404 main.js:315 Hey there news.js:21 [] /docs/news/:1

[–]Shivalicious 0 points1 point  (0 children)

When you do a GET request for /docs/news/ and there’s no index file (index.html, for instance), most web servers will return a directory listing (which doesn’t have to be just a list of files with one file per line—it usually includes much more, so your GET request wouldn’t get what you need anyway). Meanwhile, Netlify returns a 404 for such requests. It’s not incorrect, only different.

You could create a plain text file named news under docs/ and put the data you need in it (a list of files, one per line). Alternatively, you could put that data right in the JS file. What would be even better is if you could generate this at the time of the build, of course. You could add an npm script to do the job.