Sha256: 9485c6337c87b1843af4f37ba6e66e4e28d6fbfcc9a1cdc9f3cdb359e9c6bb13

Contents?: true

Size: 1.17 KB

Versions: 12

Compression:

Stored size: 1.17 KB

Contents

# URLCanonicalize

URLCanonicalize is a Ruby gem that finds the canonical version of a URL. It
provides `canonicalize` methods for the String, URI::HTTP, URI::HTTPS and
Addressable::URI classes.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'url_canonicalize'
```

## Usage

```ruby
'http://www.twitter.com'.canonicalize # => 'https://twitter.com/'
URI('http://www.twitter.com').canonicalize # => #<URI::HTTP:0x00000008767908 URL:https://twitter.com/>
Addressable::URI.canonicalize('http://www.twitter.com') # => #<Addressable::URI:0x43c9 URI:https://twitter.com/>
```

## More Information

URLCanonical follows HTTP redirects and also looks for `rel="canonical"` hints
in both the HTTP headers and the `<head>` section of the response HTML. The URL
it returns will be both normalized and canonical. The intention is that
whatever variant of a URL is supplied the result will always be the same. The
intended use case is for applications that need to dedupe a list of URLs, for
instance to check if a new URL is already present in a list. If the list is
built from canonicalized URLs then the resulting set will have fewer URLs that
point to the same ultimate resource.

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
url_canonicalize-0.1.5 README.md
url_canonicalize-0.1.4 README.md
url_canonicalize-0.1.2 README.md
url_canonicalize-0.1.1 README.md
url_canonicalize-0.1.0 README.md
url_canonicalize-0.0.7 README.md
url_canonicalize-0.0.6 README.md
url_canonicalize-0.0.5 README.md
url_canonicalize-0.0.4 README.md
url_canonicalize-0.0.3 README.md
url_canonicalize-0.0.2 README.md
url_canonicalize-0.0.1 README.md