Mike Slinn
Mike Slinn

jekyll_google_translate

Published 2023-12-27.
Time to read: 1 minutes.

This page is part of the jekyll_plugins collection, categorized under Jekyll.

This Jekyll plugin provides two tags that include a Google Translate pull-down into a web page.

The {% google_translate_html %} tag must be called to insert HTML into the page, then the {% google_translate_javascript %} tag must be called to insert Javascript into the page.

Installation

Add the following highlighted line to your Jekyll project's Gemfile, within the jekyll_plugins group:

Shell
group :jekyll_plugins do 
  gem 'jekyll_google_translate'
end 

And then execute:

Shell
$ bundle

Copy demo/assets/css/jekyll_google_translate.css to your Jekyll web site’s CSS directory, and update your layout accordingly.

Usage

_layouts/default.html
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
  <head>
    <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: nowMillis }}" type="text/css">
    <link rel="stylesheet" href="{{ '/assets/css/jekyll_google_translate.css?v=' | append: nowMillis }}" type="text/css">
  </head>
  <body>
    <nav id="sidebar">
      {% google_translate_html %}
    </nav>
  </body>
  {% google_translate_javascript %}
</html>

The above is usually incorporated into a layout, for example, _layouts/default.html.



* indicates a required field.

Please select the following to receive Mike Slinn’s newsletter:

You can unsubscribe at any time by clicking the link in the footer of emails.

Mike Slinn uses Mailchimp as his marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp’s privacy practices.