Github Pages 404 on node_modules folder - javascript

I am trying to render my GitHub repo on the Publisher-Subscriber module with JavaScript using GitHub pages. The gh-pages branch looks fine. However, the mustache code does not render on my project on GitHub Pages. It looks like this :
GitHub Repository : https://github.com/ajhalthor/pubsub-application
Github Pages Repo for this project : https://ajhalthor.github.io/pubsub-application/
The GitHub Repository also has the node_modules folder, so it should be self sufficient. Mustache, jQuery & Bootstrap are included in this folder, so there are no external links or CDNs.
Main Question : Why isn't mustache rendering even though all paths are specified relative to the project's main folder?

Github pages uses a version of Jekyll that ignores node_modules folder by default.
According to this blog article. You can do the following:
Create an empty .nojekyll text file in the root of the gh-pages branch.
You can also refer to this announcement by github which talks about the update that is responsible for this behavior.

Related

GitHub Pages - including files from same repo

So, I have a repo on GitHub which is displaying a website via GitHub Pages. The publishing source is the /docs/ subfolder on the master branch (and this is the only branch). I have some other JavaScript files in a /src/ subfolder. So essentially, the project structure is something like:
/
docs/
index.html
src/
Main.js
... (other .js files) ...
README.md
...
Now, I want /docs/index.html to be able to load and use /src/Main.js. On my local machine, this is easy enough - I can just reference it as
../src/Main.js
inside my /docs/index.html file.
However, when I try to view the live project on GitHub, there are problems. The live version of /docs/index.html file is now located at
https://(my-username).github.io/(my-repo-name)/
Therefore, it looks for /src/Main.js at
https://(my-username).github.io/src/Main.js
which returns a 404.
Actually, I don't even know where I can find the /src/Main.js file, as
https://(my-username).github.io/(my-repo-name)/src/Main.js
also returns a 404.
So, how can I load the /src/Main.js file from my /docs/index.html file? Ideally, I'd like a solution that will work both on my local machine, and on the live version.
I found the solution. It seems that GitHub Pages can only find files that are in the "publishing source". Therefore, if you have the publishing source set to /docs/, it won't be able to access files outside the /docs/ folder.
So, the solution is to set the publishing source to root /, move index.html to root, and then you can access all subdirectories of the root (including the /src/ subfolder).

Github Page Blank, not using Jekyll or create-react-app

I have a React App that I'm trying to publish using github pages but the page is blank. I've renamed the repository to my username.github.io, I'm on the master branch and the index.html file is in the root directory. The only answers I've found for this were for Apps built with Jekyll or create-react-app.
link to the repository- https://github.com/davez01d/davez01d.github.io
link to the page- https://davez01d.github.io/

how to add a vue-cli project repository in github pages?

I'm trying to add a vuejs project built using webpack in gituhub pages. I have created a repository.
renamed dist folder as a doc folder.
changed the settings-> github pages-> source to master-branch docs folder
this is the docs folder
Everything has done properly, the project is working fine when I'm running it in dev server. but when I pushed in github pages it is not working at all.
When I opened the link of the repository page i'm getting a blank window. I checked in the browser console.
I'm getting this error in browser:
.
Please find a solution for this please. More vue projects are there to upload and i'm unable to upload one at least.

How do you publish a typescript website to GitHub Pages using Visual Studio?

So I made a Typescript project with Visual Studio. It works fine when I launch it with Visual Studio, but if I try to push it to my GitHub Pages site, it will put the index.html in a subfolder and I get a 404 error when I try to load my website. Even if I try to reference the index.html in the website url it doesn't really work.
I was wondering if it's possible to only publish the needed items. I think I would only need the subfolder. Correct me if I am wrong though.
Note: I have the GitHub extension for Visual Studio installed.
UPDATE:
Since some of the links don't seem to work anymore I think I should give some extra information. So basically you need to have a branch named gh-pages. On that branch you need to have an index.html file in your root folder. Then the index.html file should be visible on the github page URL.
You need to push a branch named gh-pages in order to view it as a website.
Create a new branch and then move the file into the root folder of the branch, upload it to the gh-pages and you set to go.
Check this out:
https://github.com/nirgeier/JimVliet.github.io/tree/gh-pages
This is how your file should be inside your root folder.

Can't get gh-pages to work with Angular project

I am working on an Angular project and wanted to host the project through GitHub with gh-pages.
Since the index.html file was not in the root directory, I created an empty branch off of my master and called it gh-pages. I then copied my files into the new branch, so that the index.html file was in the root directory.
I am also using Grunt, so I copied the grunt generated app.js file into the root directory as well. I can now see the project in the browser if I go to http://kelseysteele.github.io/votm3/#/home, however the navigation bar is missing and the other pages, like http://kelseysteele.github.io/votm3/#/overview, are not working properly.
I've been stuck on this for a few days and would really appreciate any assistance with this.
Check your console, you'll see errors: GET http://kelseysteele.github.io/data/overview-data.json 404 (Not Found)
Fix the url here: https://github.com/KelseySteele/votm3/blob/master/src/votm3/Scripts/controllers/overview-controller.js#L10
Because you are using grunt, you will want to build the project before serving the files. This will make the files and code modules build properly before serving the index.html. A popular module you can use is https://github.com/tschaub/grunt-gh-pages an get your builds serving properly.

Categories