Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
This is a Sinatra Extension that integrates basic SEO functionality within your Sinatra application.
In order to install this gem, you just need to install the gem from your command line like this:
$sudo gem install sinatra-seo
You should take into account that this library have the following dependencies:
This library requires you to define the basic SEO information such as the title, the description and the keywords for every page of your site on a YAML-style separate file. Imagine that you created the file, let's say, site.seo then you should populate it as follow:
home:
title: Home | Site
description: my Home description goes here.
keywords: keyword1, keyword2, keyword3
about:
title: About | Site
description: my About description goes here.
keywords: keyword4, keyword5, keyword6
Please note that we are naming each page as named in your views/ directory. The three attributes you're required to fill (title, description and keywords) should be strings and these attributes also should have a maximum of characters or words as detailed below:
Even tough this limitation usually spark a discussion among SEO specialists, I've decided to use the minimum number in order to make sure all the data you define for your pages is parsed by the search engines.
Now, as any other existing extension, there are two possible use cases in order to hook up your site.seo file to your application. If you follow the Classic approach, then you just need to require this extension in your app.rb file and then set the SEO file this extension should parse.
require 'sinatra'
require 'sinatra/seo'
set :seo_file, File.join(File.dirname(__FILE__), 'site.seo')
# ... the rest of your code ...
In case you would prefer to follow the Modular approach on your application design, then you just need to declare your application as a class that inherit from the Sinatra:Base class in the app.rb file, then you should register the extension inside this class and finally you should set the SEO file this extension should parse.
require 'sinatra/base'
require 'sinatra/seo'
class App < Sinatra::Base
register Sinatra::Seo
set :seo_file, File.join(File.dirname(__FILE__), 'site.seo')
# ... the rest of your code ...
end
By now you should be able to use the seo helper method in your views. This method basically returns nested OpenStruct instances with read-only attributes that represents the content you wrote on the site.seo file.
seo.home.title # => 'Home | Site'
seo.about.description # => 'my About description goes here.'
seo.home.keywords # => 'keyword4, keyword5, keyword6'
Finally, you are able to implement SEO in your application with this extension!
Everybody is welcome to contribute to this project by commenting the source code, suggesting modifications or new ideas, reporting bugs, writing some documentation and, of course, you're also welcome to contribute with patches as well!
In case you would like to contribute on this library, here's the list of extra dependencies you would need:
The following sites are proudly using this extension:
If your site is also using this extension, please let us know!
This extension have been tested on the versions 1.8.6, 1.8.7 and 1.9.1 of the Ruby interpreter.
This extension is licensed under the MIT License.
FAQs
Unknown package
We found that sinatra-seo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.