All Projects → useflyyer → flyyer-ruby

useflyyer / flyyer-ruby

Licence: MIT license
Ruby helpers to create https://cdn.flyyer.io URLs | Og:Image as a Service

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to flyyer-ruby

flyyer-wp
👉 Visit the wiki: https://github.com/useflyyer/flyyer-wp/wiki | Generate social share images with web technologies
Stars: ✭ 13 (+0%)
Mutual labels:  seo, open-graph, twitter-cards, image-generator, flyyer
flyyer-python
Python helpers to create https://flyyer.io URLs for link previews | Manage your og:images from a single dashboard
Stars: ✭ 11 (-15.38%)
Mutual labels:  open-graph, twitter-cards, image-generator, flyyer
Og Image
Open Graph Image as a Service - generate cards for Twitter, Facebook, Slack, etc
Stars: ✭ 2,706 (+20715.38%)
Mutual labels:  open-graph, twitter-cards, image-generator
SeoTags
SeoTags create all SEO tags you need such as meta, link, twitter card (twitter:), open graph (og:), and JSON-LD schema (structred data).
Stars: ✭ 113 (+769.23%)
Mutual labels:  seo, open-graph, twitter-cards
Head
A simple guide to HTML <head> elements
Stars: ✭ 28,892 (+222146.15%)
Mutual labels:  seo, twitter-cards
magento2-module-seo
Magento 2 Module for Search Engine Optimization
Stars: ✭ 100 (+669.23%)
Mutual labels:  seo, twitter-cards
Meta Tags
Search Engine Optimization (SEO) for Ruby on Rails applications.
Stars: ✭ 2,464 (+18853.85%)
Mutual labels:  seo, twitter-cards
svelte-seo
Optimize your website for search engines and social media with meta tags, Open Graph, and JSON-LD.
Stars: ✭ 257 (+1876.92%)
Mutual labels:  seo, open-graph
furlex
A structured data extraction tool written in Elixir
Stars: ✭ 42 (+223.08%)
Mutual labels:  open-graph, twitter-cards
schema-and-structured-data-for-wp
Creating the best Structured Data and Schema plugin for WordPress
Stars: ✭ 66 (+407.69%)
Mutual labels:  seo
schema-dot-org
Validated structured data for websites
Stars: ✭ 42 (+223.08%)
Mutual labels:  seo
ngx-scully-blog
A simple blog made for developers that is easy to setup, supports SEO, Google Adsense, Google Analytics, Facebook Pixel, and many more
Stars: ✭ 36 (+176.92%)
Mutual labels:  seo
extra extra
Manage in-app release notes for your Rails application using Markdown
Stars: ✭ 21 (+61.54%)
Mutual labels:  gem
The-SEO-Framework-Extension-Manager
A WordPress plugin that manages extensions for The SEO Framework.
Stars: ✭ 64 (+392.31%)
Mutual labels:  seo
sitemapper
Fast, stream based XML Sitemap generator in Elixir
Stars: ✭ 32 (+146.15%)
Mutual labels:  seo
audiocard
⏯️ AudioCard - Opinionated, responsive, audio player compatible with Twitter Cards
Stars: ✭ 66 (+407.69%)
Mutual labels:  twitter-cards
universal-react-relay-starter-kit
A starter kit for React in combination with Relay including a GraphQL server, server side rendering, code splitting, i18n, SEO.
Stars: ✭ 14 (+7.69%)
Mutual labels:  seo
lightly
Ruby file cache for performing heavy tasks, lightly.
Stars: ✭ 37 (+184.62%)
Mutual labels:  gem
laravel-meta
💥 Render meta tags within your Laravel application
Stars: ✭ 36 (+176.92%)
Mutual labels:  open-graph
pixitar
🧝 Pixitar is an avatar generation library written in Ruby.
Stars: ✭ 20 (+53.85%)
Mutual labels:  gem

flyyer-ruby

The AI-powered preview system built from your website (no effort required).

Flyyer live image

This gem is agnostic to any Ruby framework.

Index

Get started (5 minutes)

Haven't registered your website yet? Go to Flyyer.io and create a project (e.g. website-com).

1. Install the library

Add this line to your application's Gemfile:

gem 'flyyer'

And then execute:

bundle install

Or install it yourself as:

gem install flyyer

2. Get your Flyyer.io smart image link

In your website code (e.g. your landing or product/post view file), set the following:

flyyer = Flyyer::Flyyer.create do |f|
  # Your project slug
  f.project = 'website-com'
  # The current path of your website
  f.path = '/path/to/product' # In Ruby on Rails you can use `request.env['PATH_INFO']`
  # (Optional, Recommended) Default or main image for each page
  f.default="/static/image-1.png" # or https://your-site.com/static/image-1.png
end

# Check:
puts flyyer.href
# > https://cdn.flyyer.io/v2/website-com/_/__v=1618281823&_def=%2Fstatic%2Fimage-1.png/path/to/product

3. Put your smart image link in your <head> tags

You'll get the best results like this:

# .haml
%meta{ property: 'og:image', content: flyyer.href }
%meta{ name: 'twitter:image', content: flyyer.href }
%meta{ name: 'twitter:card', content: 'summary_large_image' }

# .erb
<meta property="og:image" content='<%= flyyer.href %>'>
<meta name="twitter:image" content='<%= flyyer.href %>'>
<meta name="twitter:card" content="summary_large_image">

# IMPORTANT: if you're using Ruby on Rails, please use `flyyer.href.html_safe` to prevent double serialization

4. Create a rule for your project

Go to your dashboard here and create a rule like the following:

Flyyer basic rule example

Voilà!

Advanced usage

Advanced features include:

  • Custom variables: additional information for your preview that is not present in your website. [Note: if you need customization you should take a look at Flyyer Render]
  • Custom metadata: set custom width, height, resolution, and more (see example).
  • Signed URLs.

Here you have a detailed full example for project website-com and path /path/to/product.

flyyer = Flyyer::Flyyer.create do |f|
  # [Required] Your project slug, find it in your dashboard https://www.flyyer.io/dashboard/_/projects/_/integrate.
  f.project = 'website-com'
  # [Recommended] The current path of your website (by default it's `/`).
  f.path = '/path/to/product'
  # [Optional] In case you want to provide information that is not present in your page set it here.
  f.variables = {
    'title': 'Product name',
    'img': 'https://flyyer.io/img/marketplace/flyyer-banner.png',
  }
  # [Optional] Custom metadata for rendering the image. ID is recommended so we provide you with better statistics.
  f.meta = {
    'id': 'jeans-123', # recommended for better stats
    'v': '12369420123', # specific handler version, by default it's a random number to circumvent platforms' cache,
    'width': 1200,
    'height': 600,
    'resolution': 0.9, # from 0.0 to 1.0
    'agent': 'whatsapp', # force dimensions for specific platform
  }
end

# Use this image in your <head/> tags (og:image & twitter:image)
puts flyyer.href
# > https://cdn.flyyer.io/v2/website-com/_/__id=jeans-123&__v=1618281823&img=https%3A%2F%2Fflyyer.io%2Fimg%2Fmarketplace%2Fflyyer-banner.png&title=Product+name/path/to/product

# IMPORTANT: if you're using Ruby on Rails, please use `flyyer.href.html_safe` to prevent double serialization

For signed URLs, just provide your secret (find it in Dashboard > Project > Advanced settings) and choose a strategy (HMAC or JWT).

flyyer = Flyyer::Flyyer.create do |f|
  f.project = 'website-com'
  f.path = '/path/to/product'
  f.secret = 'your-secret-key'
  f.strategy = 'JWT' # or 'HMAC'
end

url = flyyer.href
# > https://cdn.flyyer.io/v2/website-com/jwt-eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXJhbXMiOnsiX19pZCI6ImplYW5zLTEyMyJ9LCJwYXRoIjoiXC9wYXRoXC90b1wvcHJvZHVjdCJ9.X8Vs5SGEA1-3M6bH-h24jhQnbwH95V_G0f-gPhTBTzE?__v=1618283086

# IMPORTANT: if you're using Ruby on Rails, please prevent double serialization like the following:
url = flyyer.href.html_safe

Flyyer Render

As you probably realized, Flyyer uses the rules defined on your dashboard to decide how to handle every image based on path patterns. It analyses your website to obtain information and then render a content-rich image with no effort. Let's say "Flyyer delivers images based on the content of this route".

Flyyer Render instead requires you to explicitly declare template and variables for the images to render, giving you more control for customization. Let's say "FlyyerRender delivers an image using this template and these explicit variables".

require 'flyyer'

flyyer = Flyyer::FlyyerRender.create do |f|
  f.tenant = 'tenant'
  f.deck = 'deck'
  f.template = 'template'
  f.variables = {
      title: 'Hello world!'
  }
end

# Use this image in your <head/> tags
url = flyyer.href
# > https://cdn.flyyer.io/render/v2/tenant/deck/template.jpeg?__v=1596906866&title=Hello+world%21

# IMPORTANT: if you're using Ruby on Rails, please prevent double serialization like the following:
url = flyyer.href.html_safe

Variables can be complex arrays and hashes.

flyyer = Flyyer::FlyyerRender.create do |f|
  # ...
  f.variables = {
      items: [
          { text: 'Oranges', count: 12 },
          { text: 'Apples', count: 14 },
      ],
  }
  f.meta = {
    id: 'slug-or-id', # To identify the resource in our analytics report
  }
end

IMPORTANT: variables must be serializable.

To decode the URL for debugging purposes:

print(CGI.unescape(url))
# > https://cdn.flyyer.io/render/v2/tenant/deck/template.jpeg?title=Hello+world!&__v=123

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Test

Run Rake tests with:

rake spec
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].