Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/the-undefined/seo
Rails engine with mounted UI to instigate activites to assist SEO peeps
https://github.com/the-undefined/seo
Last synced: about 1 month ago
JSON representation
Rails engine with mounted UI to instigate activites to assist SEO peeps
- Host: GitHub
- URL: https://github.com/the-undefined/seo
- Owner: the-undefined
- License: mit
- Created: 2014-03-18T21:26:17.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-12T19:40:31.000Z (over 10 years ago)
- Last Synced: 2023-08-01T03:59:32.883Z (over 1 year ago)
- Language: Ruby
- Size: 1.02 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
SEO
===Rails engine with mounted UI to instigate activites to assist SEO personel.
```ruby
feature %[
As a SEO administrator
I would like to use an SEO engine
So that I can achieve my tasks on my own (and not pester developers!)
] do
```## 301 Redirects
These relate to SEO in the sense of forwarding on search engine rankings that you have built up.
### Usage
Follow the steps to install the engine first, and then include the `Seo::Redirects` module in the controller that handles the pages that you would like to set up 301 redirects for:
```ruby
class PagesController < ApplicationController
include Seo::Redirects# ...
end
```Now set up a redirect using the engine Web UI: [localhost:3000/seo/permanent_redirects](http://localhost:3000/seo/permanent_redirects).
![New permanent redirect form](docs/source/new_permanent_redirect_form.png)
The form fields correspond to:
- **Origin**: The page that you would like to redirect from
- **Destination**: The page you would like to redirect toGo and hit your origin page in the browser and you'll be redirected to the destination with a status code of 301.
### Edge Cases
If your application uses methods other than generated scaffolding for finding or visiting pages then you may need to override some of the `Seo::Redirect` methods in your controller.
#### Resource Retrieval
As an example this is how you could set up the redirects to work with the [friendly_id](https://github.com/norman/friendly_id/tree/4.0-stable) gem (< Rails 4.0):
```ruby
class PagesController < ApplicationController
include Seo::Redirects# ...
private
def fetch_page_id(params)
id = params.fetch(:id)unless id =~ /\d+/ # friendly_id gem compatability
id = Seo.page_class.find(id).id
endid.to_i
end
end
```The `friendly_id` gem overrides the find method to work with slugs.
#### URL's
If you desire to use something other than the `url_for` method to determine where to redirect to, perhaps you have a catchall route (`get '/*path', to: "..."`), then you can override the `url_for_destination(page)` method:
```ruby
class PagesController < ApplicationController
include Seo::Redirects
# ...private
def url_for_destination(page)
link_generator_for(page.slug)
end
end
```## License
This project uses MIT-LICENSE.