Use remote .json file in my Jekyll project - jekyll

I am trying to use a github api to generate content in my jekyll project. Currently I can generate the desired content using the .json file locally in the _data directory. However, I want to be able to use the .json file from github every time the site is built to update the content in the project without having to manually re-download the file and place it in the project directory. Is this possible and how can this be done? Also the project is being hosted by github pages so my plugin usage is limited.

Related

Using YAML and Images from a single directory in Jekyll

I have a Jekyll-based and Github-pages-hosted site. I also have a Git Submodule that contains both YAML files and images. I would like to use it within my GitHub pages Jekyll project but I’m not sure how.
Here's example directory structure:
/assets/
/_data/
/MyGitSubmodule/yaml/
/MyGitSubmodule/images/
I’m used to putting YAML files in _data and images in /assets/. Is there a way to configure Jekyll also parse YAML files in another directory? Or copy static files from somewhere in _data during the build step? Or set up symlinks? That work with GitHub Pages?
I've tried:
Changing the data_dir setting to be the same as my /assets/ directory but I don't want to make my data files publicly accessible.
Creating a symbolic link on Windows with mklink /D but I get an error on servingC:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.2.2/lib/jekyll/utils.rb:141:in initialize': Is a directory # rb_sysopen - C:/Ben/personalsite2/assets/unreal/specifiers (Errno::EISDIR)`. Also ]this page seems to imply that they work on GitHub pages](https://github.com/chetabahana/symlink) but other docs for Jekyll seem to say that they are disabled in “safe mode” and GitHub pages.
Eh in the end I solved this by putting my data_dir inside /assets/ and by by using the exclude setting in config.yml to stop it from serving some of the yml files

Gulp download remote JSON files during build

I have a static site reliant on a remote JSON file which is under my control and doesn't change much.
I'm using gulp to build the static site and would like to add a gulp task to automatically get the remote JSON during the build, so I can include it as a local file.
I've not come across a plug-in to do this. Can anybody suggest one?
Found it! https://www.npmjs.com/package/gulp-download-files will allow you to download files locally.

Permanently redirect Jekyll pages to external site without markdown?

Using Jekyll/Github pages. As part of a content overhaul, we've moved a lot of pages to an external site. We'd like to clean up our Github pages repository and remove all purged files while providing a 301 redirect to the new domain where they now live.
The problem is that - according to my understanding of the docs - you must have a markdown file present with a redirect_to field. This defeats the purpose of purging the files in our repo. Is there a way to configure redirects from the _config.yml file or a plugin that allows me to do this from a single file?
I cannot see how this can be possible on the GitHub platform. As you mentioned, you can use the jekyll-redirect-from plugin but you cannot automate it through config or other data files because Jekyll sites are static and thus, the server will only look for the directory and an index file within it for each URL.
The only way you can achieve this without keeping the file structure is to move the site to a server where you configure URL rewrites within the web server such as Nginx or Apache.

Index.html/index.php not found in Google CodeLabs app shell

I was interested on on Google's web app-Shell. I've downloaded it GitHub. But I found that there is no index.html/index.php file in the whole code. All I mainly found, is the licence file, app.yaml file and app.js file. Link to that page, is here.
I heard,that I can install the project in my web hosting site, by using terminal. But terminal is not an option for my situation. I've stopped using Firebase, because I must have terminal for it. So, is there any other idea to install the project in my website?
Can I have a flat file, so that I could simply past the html,css, JavaScript and other media files into my server?
Unfortunately the Google web app-Shell isn't designed to have an index.html file. There is a views folder that has what you're looking for https://github.com/GoogleChromeLabs/application-shell/tree/master/server/views.
As we can see they're using handlebars for as a templating system. For example, if we look at https://github.com/GoogleChromeLabs/application-shell/blob/master/server/views/layouts/default.handlebars we can see that they have {{> open-page}} and {{{body}}}. If we look at handlebars documentation these partials are rendered into other views.
Essentially, there isn't a single index.html we can point to, but we can reconstruct the app by exploring their views.

Use Jekyll to generate static pages locally

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.