Liquid error when trying to embed twitter feed on GitHub Jekyll page using plugin - twitter

I am trying to embed my twitter timeline on my Jekyll Blog hosted on Github.
This is the plugin I am trying to install: https://github.com/rob-murray/jekyll-twitter-plugin
These are instructions I am using to install plugins in general: https://jekyllrb.com/docs/plugins/
The site above includes the warning:
Plugins on GitHub Pages
GitHub Pages is powered by Jekyll. However, all Pages sites are generated using the --safe option to disable custom plugins for security reasons. Unfortunately, this means your plugins won’t work if you’re deploying to GitHub Pages.
You can still use GitHub Pages to publish your site, but you’ll need to convert the site locally and push the generated static files to your GitHub repository instead of the Jekyll source files."
Does this mean what I am trying to do is impossible, without building the site statically, since I am using Github pages? I am lead to believe not, because I encounter an error even when serving the site locally on my laptop.
However, I get the following error when I place the example {% twitter https://twitter.com/jekyllrb maxwidth=500 limit=5 %} into my index.md file. When I do jekyll serve --watch locally, it gives the error:
Liquid Exception: Liquid syntax error (line 7): Unknown tag 'twitter' in index.md
I do not know if the error is in my installing of the jekyll-twitter-plugin, or in the way I am using. For reference, to install the plug I did the following:
put jekyll-twitter-plugin in my _config.yml file under the gems: header
put gem 'jekyll-twitter-plugin' into my Gemfile
did sudo gem install jekyll-twitter-plugin locally on my own machine.
Can anyone help me figure out what I've done wrong?

That plugin is not supported by Github Pages, so it won't work there. The only possibility to use it is to build your site locally before pushing your site to Github Pages.
If you want to install it locally anyway, after adding the gem to Gemfile, Install the gems specified in that Gemfile:
bundle install
Then continue using the plugin tags in your posts.

Related

Rails 5 is serving old assets on heroku

My Rails 5 application is behaving weirdly. The application is on heroku.
I am using the gem tinymce-rails. Recently, this gem got updated to version 5 which uses new functions. After deployment I faced an issue where one of the plugins (the link plugin) could not be loaded due to using the old syntax.
I am using chrome to open the website. For some reason the tinymce plugins javascript files are not up to date. They also don't have that fingerprinted name with the hash in the end. All other javascript files do however.
I ran heroku run rake assets:precompile; heroku run rake assets:clobber;. It was no good.
I then tried to open the website in incognito mode and found that the tinymce plugins are the up to date ones. Still though without the fingerprinted file names.
How can I force that the old plugin javascript files be invalidated? I will not have control over my users to ask them to clear their caches.
How can I force using the fingerprinted files? I have inspected the heroku server file system and found assets/tinymce/plugins/link
having both fingerprinted and non-fingerprinted files however the non fingerprinted files were the ones used.

How to use jekyll on an existing blog made with rails

My situation is that I have just finished creating a blog using ruby on rails. I have been using localhost to see it display on my browser, but I want to deploy it online. I found out that rails apps can't be deployed on ghpages because it is not static. However, I searched online and read that if I used Jekyll, i could display it on ghpages. I have never used jekyll before, so my question is...
How could I use/integrate jekyll to my existing rails app so that it can be deployed and hosted through github pages?
Thank you!
You are trying to screw in a screw with a hammer.
Github pages is simple free hosting for static pages like a simple portfolio or the info page for a github project. You would use jekyll to generate simple static HTML pages for this.
If you want to deploy a Rails application there are several cloud hosting providers such as Heroku and Openshift that provide a free tier.
First determine what you are trying to build. Then select the right tool and hosting for the job.
You CANNOT host a rails blog app with databases on gh pages. you need a static site to be hosted on ghpages. jekyll is a static site generator that generates static HTML pages which can be served to users from gh-pages.
So you need to build new blog engine with jekyll
install jekyll: gem install jekyll
create new jekyll site: jekyll new your-github-username.github.io
cd to the new directory generated and test locally: jekyll serve (visit http://localhost:4000)
link to github articles on gh-pages with jekyll

rails vendor folder angular2 development and production

Hello very amazing coders,
I'm currently using npm to manage angular2 dependencies. I then manually copy the required angular2 files from node_modules into my rails vendor folder. The rails will make those files available for me to load. However, I've read that vendor files should not be in source control. Ok, fair enough, I agree. However, if I .gitignore these files, they do not make it onto heroku. And subsequently my <script></script> tags in app/views/layouts/application.html.erb return 404's not found.
I'm looking for overall guidance on how you guys do vendor assets in production vs. development? In my case, a gem for angular2 source files does not exist, so pretend that is not an option.
There's so many flavors for this and as everything else it depends on your project. Here are some:
1- You can use cdn versions of the libraries in production, which is supposedly better because there's a good chance that people visiting your page would have already downloaded jquery or w/e from a cdn while visiting another page so you they don't have to download yet another copy for your page alone. Like https://www.maxcdn.com/ or https://developers.google.com/speed/libraries/.
2- You can have one repo with your code on it, sources and all, without the vendor files and one more repo connected to heroku where you push only the distributable build of your project including if you want, the vendor files.
3- Run the same npm install and all other configuration scripts you normally use from your production server, Heroku should allow you to do this np, or at least have a plugin for it.
I hope this helps.

SASS bundling and minification works locally but not on Azure Websites

I have setup SASS bundling with Bundle Transformer: Sass and SCSS and it works great locally in debug and release mode, it builds through Azure Build Server, and delivers without any build issues to my Azure Web Site. Problem is that it doesn't appear that the SASS is compiling into CSS. Looking at the source on live site this shows for the CSS:
<link href="/Content/test?v=" rel="stylesheet">
without the hash that you'd expect, and see locally. Looking at the stylesheet there is nothing in it.
Code that I have to make the bundle:
var commonStylesBundle = new CustomStyleBundle("~/Content/css");
commonStylesBundle.Include("~/Content/site.scss");
commonStylesBundle.Orderer = nullOrderer;
commonStylesBundle.Transforms.Add(new CssMinify());
bundles.Add(commonStylesBundle);
You have registered a bundle with the address "~/Content/css", but try to get the bundle with the address "/Content/test".
In addition, is not recommended to use the CssMinify and JsMinify classes together with a Bundle Transformer. I will not explain why it should not do, because I have written about this in the documentation (http://bundletransformer.codeplex.com/documentation). As most simple solution to this problem I recommend to install the BundleTransformer.MicrosoftAjax (http://nuget.org/packages/BundleTransformer.MicrosoftAjax) package.

Download all gems and dependancies from github or a seperate server instead of RubyGems?

My companies networking won't allow us to access almost any site but github, so I'm wondering how I will be able to install gems.
Option 1: point to the github source of all the gems, but wouldn't we also have to specify the dependencies from github as well ?
Option 2: We have a proxy server which has access to RubyGems, and I'm thinking if we can download all the gems and dependencies there then we can source the gems over to that machine. Would I need to literally host the files on that server to point at them from my gemfile?
Are either of those options possible ?
Edit:
I think this question solves my problem: How to build a rubygems mirror server?
You can source your gems from 'gems.github.com'. They publish a list of gems that can be sourced from them here: http://gems.github.com/list.html As I understand the list is no longer being updated though, so you'll run into problems eventually.
I guess you could try to run a local mirror. Found this after a quick google: https://github.com/rubygems/rubygems-mirror
That said, I'm with mpapis. If you are working for a company that wants you to code Ruby and they don't allow use of rubygems.org I'd ask myself some serious questions about whether I'd want to be employed there.

Resources