I am desperate.My mission is to deploy a static website generated using Jekyll into GitHub Pages, using the "Project" option (instead of the user option).
Somehow, when I use Jekyll to check the website in my machine, everything works fine. But once I deploy it to Git Pages, all my CSS files stop working, and every link leads to a 404 not found error.
I have followed several guides and tutorials but they all fail:
Using Github Pages to host a website v2
Jekyll Documentation
Building Static Sites with Jekyll
building-a-docs-site-with-jekyll-github-pages
So far I always created the repositories, the branches and I always push everything. I do not believe the error is in the deployment, but in some place else.
My repo can be found here:
Fl4m3Ph03n1x web-tutorials repo
For those of you wondering, so far the repository is only the result of one tutorial:
- AndrewMunssel tutorial
I have also tested other tutorials, but I always end up with a problem. Is my code wrong? Are the tutorials I am following outdated and incorrect? What should I do?
Everything on your site is in a sub directory off of the domain so the main site is accessed here
http://fl4m3ph03n1x.github.io/web-tutorials/
The templates are pointing to directories on the root of the domain so it is trying to load your stylesheets from http://fl4m3ph03n1x.github.io/assets rather than where they are located http://fl4m3ph03n1x.github.io/web-tutorials/assets/ the same thing is happening for your posts.
What you need to do is set the baseurl in your _config.yml
baseurl: /web-tutorials
you then need to modify your templates so that the paths to CSS and JS use the following convention
{{ site.baseurl }}/path/to/css.css
and for post links
{{ site.baseurl }}{{ post.url }}
You also need to update the site setting in _config.yml
Related
I recently worked on a personal project using React and that included files like: app.js, app.css, index.js and everything worked smoothly. However, when trying to deploy the site, I keep receiving this
error. My main files are within the src directory shown here. On the github pages tab, what should I change the custom domain to so that I can successfully deploy the website?
I've also read somewhere that I can create a dummy index.html file, but I am still deeply confused. Any guidance on how to deploy the site would be greatly appreciated.
Thank you!
This article contains steps needed to deploy react app in github pages.
Article Link: here.
I created a simple website with Jekyll and pushed it to a github repository.
A website was created at <myusername>.github.io and it looks perfect: just like it was when I hosted it locally with jekyll serve.
Afterwards, I connected it to a custom domain following the official instructions (changing the cname a A host), and all worked correctly: now github shows a message saying: "Your is published at ."
But now, when I enter , the website is completely "deformed": images have the wrong size, links don't work etc...
It is strange that all worked correctly when using the default domain, but now it broke.
What is the issue here?
I ended up solving it myself by changing the url in _config.yml to the new domain (It was still set to the github.io domain).
I cloned a Jekyll Theme - Solid for use in my personal project website. When running it using jekyll serve locally, I get this as the output:
However, when I hosted it using Github Pages, this is what I get as the output:
Basically, all the images are loading. Even the network monitor in the browser shows status 200 for all the files, including stylesheets and scripts. There is no 404 Not Found error for any dependency file.
Also, as per the instructions from the theme README.md, I also changed the _config.yml accordingly:
baseurl: "/solid-tesing" #important: start with / -> repository name
url: "https://sahilarora535.me"
I also tried publishing the website as the main user website in the repository username.github.io with appropriate changes in the _config.yml, however, this also gave the same output. What and where is the error?
Additional Information - The jekyll serve command runs the server successfully, with 3 warnings. On removing the code with warnings, no change in the resulting website is seen.
Figured out the problem. The original code had a css file with yaml block and liquid tags in it. I don't understand why it was being correctly rendered locally, however, yaml is not supported in css. I changed the extension of the css file to scss and everything worked like a charm.
However, I still am not sure if yaml actually works in css. The source code had a lot of bad tweaks to include site color variables in _config.yml to stylesheet file.
I've used static site generators like jekyll and had it hosted through github pages just fine using prose.io as a content management system.
I decided I wanted to go with a site using Hexo static site generator, but I cannot seem to figure out a good workflow for publishing content.
To my understanding this is the following in how I'd have to do it:
write *.md text file
hexo generate
(optional) hexo serve (to see local content)
hexo deploy (to publish the public content to whatever site using config.yml). Can publish on amazon S3, github pages, etc
Is there another workflow other than this?
the way I've been doing it before with jekyll+github pages is simply
go to prose.io
Write content
save (which publishes ocntent)
Ideally I'd like to use hexo+github pages the same way I do with jekyll+github pages.
Basically, can github generate static files automatically like it does with jekyll / ruby packages?
I figured out my own answer and posted it on my blog
http://www.tangycode.com/Quick-Start-Guide-To-Hexo-Install/
It covers everything you need to know on how to set up a hexo blog site and manage content workflows
One approach I am trying myself:
prose.io or similar to write and save on github repository
travis-ci.org to build hexo site and deploy
This is how it works:
Edit document on your editor of love
Commit it to your repository
travis-ci.org detects the commit and start working
My .travis.yml do (among few other things) the follow:
npm install hexo-cli
npm install grunt-cli
npm install inside siteĀ“s repository (hexo plugins and dependecies)
hexo generate
grunt deploy-production
hexo deploy (I use this to have a historic of the site stored in the repo itself)
If your editor of choice can direct commit to github repository your have exact same experience you had with Jekyll on GH pages. The advantage here is that you can use third-part plugin what GH pages avoid.
Alternatively, you can use INSTANT, which is a content management tool that you can use on any static website. You just install their javascript and can directly edit content in your website (without any admin dashboard). It saves and serves the content from the client. Pretty neat.
The easiest way is to use a hosting provider like Netlify in combination with a headless CMS, for example Headless (full disclore: I created it).
Netlify can do the build process for you and during that build process, it can fetch content from a headless CMS. Whenever you update content in the CMS, then Netlify does a rebuild.
Then you have your website on the Netlify CDN, a real CMS for your content management and you never need to dive in your code or github files. And that's all for free.
I want to host a simple blog on Github pages. Therefore I set up a repository and used Hexo as a compile and deployment tool.
After testing my site locally I run the following command:
hexo deploy --generate
Sadly I, just a few seconds later, get the following message from Github:
The page build failed with the following error:
The hacker theme is not currently supported on GitHub Pages. For more
information, see
https://help.github.com/articles/adding-a-jekyll-theme-to-your-github-pages-site.
For information on troubleshooting Jekyll see:
https://help.github.com/articles/troubleshooting-jekyll-builds
If you have any questions you can contact us by replying to this
email.
How can I publish my site using the hacker theme? If this is not possible which themes are supported by Github? How do I use them with Hexo?
Bypassing Jekyll on GitHub Pages
It is now possible to completely bypass Jekyll processing on GitHub
Pages by creating a file named .nojekyll in the root of your pages
repo and pushing it to GitHub. This should only be necessary if your
site uses files or directories that start with underscores since
Jekyll considers these to be special resources and does not copy them
to the final site.
Source: https://github.com/blog/572-bypassing-jekyll-on-github-pages
[..] I used the username.github.io repo and deployed directly to master
and it works!
https://github.com/CodeDaraW/Hacker/issues/9