unslash
Version, currently 1.0.03 versions
- 1.0.0latestMay 29, 2023
- 0.1.1not indexedAug 23, 2023
- 0.1.0not indexedAug 23, 2023
github.com/GrottoPress/unslash
A Crystal HTTP Handler to remove trailing slashes from URLs
Installation
# Add this to your shard.yml
dependencies:
unslash:
github: GrottoPress/unslash
version: ~> 1.0.0Then run:
shards installshard.yml
- Crystal
~> 1.0- License
- MIT
- Authors
- GrottoPress, N Atta Kusi Adusei
Dependencies
Development Dependencies
- ameba~> 0.14.3github: crystal-ameba/amebadev
README
Unslash
Unslash is a Crystal HTTP handler that removes slashes (/) at the end of URLs, performing a redirect to the unslashed version of the same URL.
This, among others, improves SEO by avoiding duplicated content across the different versions of the same URL.
Installation
-
Add the dependency to your
shard.yml:dependencies: unslash: github: GrottoPress/unslash -
Run
shards update -
Require Unslash:
# ... require "unslash" # ...
Usage
Pass an instance of Unslash::Handler to the web server. If using a web framework, this handler should be passed before the framework's route handler:
# ...
require "http/server"
require "unslash"
server = HTTP::Server.new([
# If `safe` is `true`, only `GET` and `HEAD` request methods
# are handled.
Unslash::Handler.new(status_code: 308, safe: false),
# ...
])
server.bind_tcp("127.0.0.1", 8080)
server.listen
# ...
Development
Run tests with crystal spec.
Contributing
- Fork it
- Switch to the
masterbranch:git checkout master - Create your feature branch:
git checkout -b my-new-feature - Make your changes, updating changelog and documentation as appropriate.
- Commit your changes:
git commit - Push to the branch:
git push origin my-new-feature - Submit a new Pull Request against the
GrottoPress:masterbranch.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.0.0- Tagged
- May 29, 2023
- Commit
81220c30613d- Crystal
~> 1.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/GrottoPress/unslash
Metadata
- Created
- Aug 17, 2026
- Updated
- Aug 17, 2026
- Synced
- Aug 17, 2026
- Versions
- 3