Use Jekyll to generate static pages locally - jekyll

After reading some documentation, I find Jekyll-based project will work on a Jekyll aware web server, what if I just need to generate static pages locally, is there a way to publish locally, I just need the generated blogs locally and will host it in a plain static web hosting.
Can Jekyll generate static pages locally (for blog posts)?
Can Jekyll generate post or blog folder that can be navigated through a navbar which is part of the blog list template?
What should be the format of the blog list to be able to be Jekyll-friendly?

The answers are yes, yes and liquid/html. Just install Jekyll locally and look for the generated _site folder. It will exceed your expectations, for sure.

Related

deploy a Jekyll site with the use of a

This is the first time that I am going to use Jekyll to build a static site. I would like to use a dozen plugins that are not white listed for deploying on Github. My question is : is it possible to deploy a such site with a dozen plugins (not white listed) on github ?
Browsing on internet, I found the following assertions :
1) We can't run user plugins on GitHub Pages due to security restrictions. That' what the documentation says
2) You are free to generate your site locally and push the resulting HTML to a Git repo, however : what does that means ? First when you generate the site locally, it ends with a group of HTML files and that group of html files, are they enough to run the site autonomously (for example must you include the css files in html pages ) ? Furthermore when you push the resulting HTML to a Git repo, is it enough to deploy it on a production environment (on GITHUB for example) ? and how you do that ?
3) on this link (https://help.github.com/articles/using-jekyll-plugins-with-github-pages/) I found the following explaination : Adding Jekyll plugins to a GitHub Pages site
You can further customize your GitHub Pages site by adding Jekyll plugins. (do they talk about all plugins ?)
GitHub Pages officially supports the Jekyll plugins found in the GitHub Pages gem. For the exact versions of the Jekyll plugins that GitHub Pages supports, see this list of GitHub Pages dependencies. Other plugins are not supported, so the only way to incorporate them in your site is to generate your site locally and then push your site's static files to your GitHub Pages site.
So as they say, it is possible , generating your site locally and then pushing your site's static files to your GitHub Pages site. Is there a detailled procedure example somewhere ?
Thanks in advance for your answers
To be able to use Jekyll with any plugins and host in Github pages you have two options
first alternative
Build your site locally and then push the resulting site at _site to Github.
Then push the built site's static files to your pages publishing branch (gh-pages or master depending on your site type).
GitHub Pages supports any HTML or static files you push to it so you
can use any static site generator to build your site. You can even
just push raw HTML files to GitHub Pages and it will build your site.
You can also customize your own build process locally or on another
server.
second alternative
Use a CI service like Travis, so when you push your Jekyll files to Github, it automatically builds your site and deploy it to your publishing branch.

How should I set up my repository using GitHub pages so I can see all the files that the site uses?

Can I set up my repository so that I can see all the files (html and css) that my site uses in the repository while still using the GitHub page generator?
I want to use github.com to maintain my multi page site, without installing Jekyll locally.
After you create your github repo go to the settings and select the option to host from the docs directory I found this to be the best method to host my websites that way you done have to mess with different branches unless your in to that thing.
It is not required for you to use Jekyll I personally have never used it. It is to wordpress esq.
What you can use instead of Jekyll is a static site generator or spa to precompile your website content add the static content to the doc directory and push your repo.
Github will generate a url for your that will also be available in your settings. You can also add custom domains.
I recomd using a static site generator performance and seo is the reason.
If you create a Jekyll website on your local machine in /some/path/website/, initialise your Git repository there:
cd /some/path/website/
git init
Then you can push this to your remote Github repository and all of your files will added and viewable.
I don't think you can initialise a Jekyll website in your remote repository though.
From their documentation:
Jekyll's simplified build process with GitHub Pages is one of the biggest advantages of using Jekyll instead of other static site generators. GitHub Pages manages your site's build process with a single push to your site's publishing branch. This is Jekyll's build process for managing your site:
Push file changes to your pages publishing branch (my emphasis)
GitHub Pages publishes your site.
It turned out that the reason I was not seeing many files was that there was only the index.html that I created using the tutorial at GitHub Pages
The reason I thought there must have been other files was that the theme I picked looked a whole lot better than my helloworld.html

How to change site URL in Jekyll when switching from development to production

When I am developing my website locally (jekyll serve --watch), the HTML files in the _site dir have http://localhost:4000 URL. However, when I deploy the site to firebase, they remain the same instead of switching to the relative domain URL. My domain url is http://blogprime.com.
So what I want is ... when I am developing the site locally, every link (CSS, JS, fonts, post link, pages ) have https://localhost:4000/ ... but when I use the jekyll serve it should change to my domain name that is https://blogprime.com/ followed by the relative link to CSS, JS, fonts and other files.
Update: I just noticed the date this question was posted!
You need not change links in production and development. You can conveniently set the "url" param in config.yml.
This does two things,
when you do a jekyll serve and serve the site locally then site.url is set to localhost:4000
when you do a jekyll build site.url is replaced by whatever domain name you set in the config.
Post this you can deploy the _site to the root of your server where your domain points to.

Having trouble building jekyll locally and deploying to gh-pages

A few months ago, I set up a site using jekyll and it's hosted on github pages here: http://sethxd.github.io. Originally, I just figured I'd let github pages handle the building because I wouldn't need to use plugins.
Well, now I'd like to use plugins. I've tried to follow a few tutorials online to set up a separate source branch, but I keep running into git errors and conflicts. I'd also like to set up a rakefile or other tool to build and deploy this automatically in the future.
I'm on Windows, running Jekyll 3.0.
GitHub Pages doesn't allow using most of Jekyll plugins for security reasons, but some can be used. The only way to deploy a Jekyll website to GitHub that uses plugins is via _site folder. You only upload the content of this folder, so GitHub won't build the site for you, it will display it as simple html.

Jekyll Localized Host

I'm pretty sure it's not possible but does anyone know of a configuration that can localize the exported files in Jekyll so that the _site content can run independent of a web host?
I want to use Jekyll to develop a site, and deliver the contents of the _site folder for hosting, but I will not have the hosting information ahead of time. So I would like to be able to run the index.html file in the _site folder directly from the Desktop and have the site work properly. That way I can deliver the files and the site will run using relative paths/links regardless of where the files end up being hosted.
This possible but you need to know where your generated site will be located on the filesystem. This, because of the relative links pointing to resources (js, css, images).
For example a site generated at /home/user/www/_site, index page will be serve in your brower at file:///home/user/www/_site/index.html, so you'll have to set baseurl in _config.yml to baseurl: /home/user/www/_site in order to have you site working.
On windows it can be baseurl: /C:/Users/New/www/_site