keithmifsud / jekyll-target-blank

Automatically opens external links in a new browser for Jekyll Pages, Posts and Docs.
MIT License
105 stars 19 forks source link

Plugin not working #32

Closed GiacomoLaw closed 5 years ago

GiacomoLaw commented 5 years ago

Hi there!

Trying to add this to my site here: https://github.com/giacomolaw/blog

However, as you can see from this link, the URLs do not open in new tabs: https://giacomolaw.me/blog/...

What am I doing wrong?

Thanks!

keithmifsud commented 5 years ago

hmm..first..thank you for raising the issue here :) Unfortunately, I might need to leave before it is fixed as it is late where I'm at atm. Can you show your config file please..you can hide anything sensitive?

GiacomoLaw commented 5 years ago

Source is public: https://github.com/giacomolaw/blog

Thanks :)

keithmifsud commented 5 years ago

Hi @GiacomoLaw I will very happily look into this in the next 10 hrs..promise :) Sorry..It is late now :(

GiacomoLaw commented 5 years ago

Thank you, no hurry!

πŸ˜„

keithmifsud commented 5 years ago

Hi @GiacomoLaw thank you for waiting πŸ‘

I cloned your repo and then...

bundle install
bundle exec jekyll serve

On my localhost, the plugin works but as you noted it does not work on the remote host. Is this hosted on GitHub? If it is, please note that you cannot use any Jekyll Plugin unless it has been developed by GH team such as the emoticons plugin.

jtb

keithmifsud commented 5 years ago

By the way, I like your website, especially the search feature πŸ˜„ Just to elaborate on my answer, if you're hosting the site on GitHub Pages, you will not be able to use any Jekyll plugins unless they have been developed by GH as listed here https://pages.github.com/versions/ . We have requested GH to allow more plugins but I don't think they will any time soon.

If this is your case and you'd like to use either JTB or another community plugin, I suggest you host the website on either Netlify or Firebase. Both are free for most use cases. My site is hosted on firebase.

GiacomoLaw commented 5 years ago

Yep it’s hosted on GitHub pages. I’ll take a look at Firebase, thank you!

keithmifsud commented 5 years ago

Sure. If you need help with Firebase, just let me know.

GiacomoLaw commented 5 years ago

Is there a guide on setting it up for windows? Thanks πŸ™‚

keithmifsud commented 5 years ago

It's actually very easy on any platform as the CLI is simply an NPM. This should get you started https://codinginfinite.com/firebase-database-profiler-performance-with-firebase-tools/

You need to create a project on Firebase.

But basically, I developed a small script which builds Jekyll on a separate directory and then pushes the already generated static files to firebase. The difference is that on GH you just push your source code and GH will build the site for you. With Firebase, you should build the site locally and deploy the static files to it.

GiacomoLaw commented 5 years ago

So do I have to rebuild the site very time I make a blog post?

keithmifsud commented 5 years ago

Yes, you do so already. When you run jekyll serve it builds the site and again on every change. Just jekyll build and give a path where you want the built files.

keithmifsud commented 5 years ago

I have this script:

#!/usr/bin/env bash

JEKYLL_ENV=production bundle exec jekyll build

rm -rf ./../publish/public

mkdir ./../publish/public

cp -rf ./_site/* ././../publish/public

cd ./../publish/

firebase deploy

In the publish directory I have the firebase.json file:

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "cleanUrls": true
  }
}

and the .firebaserc file:

{
  "projects": {
    "default": "keith-mifsud"
  }
}
keithmifsud commented 5 years ago

Basically, the first file is named deploy.sh and lives in the website's source. Every time I want to deploy the changes, I just run it bash ./deploy.sh and the site goes live in seconds.

GiacomoLaw commented 5 years ago

Okay, thanks. I was hoping for something more simple so I could set up a friends blog, and they don't really know about any of this.

Thanks however!

keithmifsud commented 5 years ago

You're welcome. I really don't think this is any more complicated then committing and pushing to GitHub. You may want to take a look at Netlify?

GiacomoLaw commented 5 years ago

Will do, thank you! I am happy with Firebase, so I may move my personal site over there. Just for friends who have no experience with terminals and programming.

Thanks!

mlhaufe commented 3 years ago

There may be a workaround for GitHub Pages:

https://blog.samplasion.js.org/build-jekyll-with-custom-plugins-on-github-pages

erin-bristow commented 2 years ago

@mlhaufe thanks for that! I managed to get it going using the official Jekyll docs.

Two problems I ran into, for anyone who tries to use the Jekyll docs - after the gh-pages branch is created, switch to gh-pages branch in the settings for your github pages repository. Also need to include target_branch: gh-pages but that's the only thing I had to change in provided github-pages.yml file.

erin-bristow commented 2 years ago

[more notes for anyone that may or may not be reading my comments] There can be issues with custom domains. The CNAME record will not be automatically placed in the new gh-pages branch, and you cannot manually create the CNAME record file in the gh-pages branch because it will be overwritten every time your site is rebuilt. In the _config.xml file you need to add 'include: CNAME' to force it to include that record.