Skip to content

Commit

Permalink
Merged in feature/read-me-improvments (pull request #2)
Browse files Browse the repository at this point in the history
Feature/read me improvments

Approved-by: Kelum Wijewardhana <[email protected]>
  • Loading branch information
Banura Randika authored and fidenz-kelum committed May 19, 2020
2 parents 22c732d + ac831ea commit e4d9c04
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 20 deletions.
74 changes: 58 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,27 @@ After updating your bundle, run the migration as follows:

First, add this code to your main layout:

```erb
```erbruby
# application.html.erb
<head>
<%= display_meta_tags site: 'My website' %>
</head>
```
### Options
These options can be used in the both static pages and dynamic pages. For examples please refer each usage guides.

| Option | Description |
| -------------- | ----------- |
| `:separator` | text used to separate website name from page title |
| `:lowercase` | when true, the page name will be lowercase |
| `:reverse` | when true, the page and site names will be reversed |
| `:noindex` | add noindex meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:index` | add index meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:nofollow` | add nofollow meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:follow` | add follow meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:noarchive` | add noarchive meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:canonical` | add canonical link tag |

### Static Pages

Expand All @@ -69,6 +83,16 @@ def home
end
```

If you want to include any above mention options to meta tags You do that as follows:

```ruby
# some_controller.rb

def home
set_meta_tags FiSeo.create_static_meta_tags(controller_name, action_name, social:%i[facebook twitter], lowercase: true, noindex: true)
end
```

If the few action in a same controller with static pages use this instead:

```ruby
Expand All @@ -94,7 +118,7 @@ For dynamic seoable pages you need to configure model as follows:
acts_as_seoable :title, :description, :keywords
```

If the model as attributes for that you need to use for the seoable attributes you can add as above. You can also build and set by method as well.
If the model has attributes for that you need to use for the seoable attributes you can add as above. You can also build and set by method as well.
```ruby
# model.rb

Expand All @@ -106,28 +130,19 @@ end
```
when you create a new record from this model the gem will create a corresponding seoable record as well. Above values will be set as default values.

#### Options

For dynamic records you can have option set for the model. Those options as follows:

| Option | Description |
| -------------- | ----------- |
| `:separator` | text used to separate website name from page title |
| `:lowercase` | when true, the page name will be lowercase |
| `:reverse` | when true, the page and site names will be reversed |
| `:noindex` | add noindex meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:index` | add index meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:nofollow` | add nofollow meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:follow` | add follow meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:noarchive` | add noarchive meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
| `:canonical` | add canonical link tag |
For dynamic records you can have option set for the model.

And here are a few examples to give you ideas.

```ruby
# model.rb

acts_as_seoable :title, :description, :keywords, social: [:facebook, :twitter], noindex: true

# model.rb

acts_as_seoable :title, :description, :keywords, social: [:facebook, :twitter], lowercase: true
```

For social tags default they are empty. It can be set by the model as follows:
Expand Down Expand Up @@ -251,8 +266,35 @@ form do |f|
end
```

### Screenshots

![activeadmin-dynamic-seoable](./screenshots/dynamic-pages-seoable.png)

Above image show how active admin backend let you configure the dynamic **seoable** records. To achieve this please
follow dynamic pages active admin guidelines.

![activeadmin-static-seoable](./screenshots/static-pages-seoable.png)

Above image show how the static routes can be configured using active admin generator. It will capture the routes and show
it in here to edit.

![activeadmin-static-seoable-frontend](./screenshots/static-pages-seoable-details.png)

Above image show how the meta details has been configured from the backend using active admin for a static route.
These details will appear in the frontend (inside the head tag).

![activeadmin-static-seoable-frontend](./screenshots/static-pages-seoable-frontend.png)

Above image show how the meta tags has been rendered inside the head tag for a static page.
These can be changed by active admin or your backend itself.

## ToDo Features


## Getting Help

Got a bug and you're not sure? You're sure you have a bug, but don't know what to do next? In any case, let us know about it! The best place for letting the Contributes know about bugs or problems you're having is on the page at GitHub.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fi_seo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/fi_seo/blob/master/CODE_OF_CONDUCT.md).
Expand Down
9 changes: 5 additions & 4 deletions fi_seo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Gem::Specification.new do |spec|
spec.name = 'fi_seo'
spec.version = FiSeo::VERSION
spec.authors = ['Banura Randika']
spec.email = ['[email protected]']
spec.email = ['[email protected]', '[email protected]', '[email protected]']

spec.summary = 'FI_SEO summary'
spec.description = 'FI_SEO description'
spec.homepage = 'https://bitbucket.org/fidenz/fi_seo_ror/'
spec.summary = 'Flexible SEO solution for rails projects'
spec.description = 'This gem provides a easier solution to search engine optimization(SEO) in a ruby project. This will give you the seo capabilities to your static pages anddynamic pages alike with few lines of code.
Also site maps are essential to the SEO of your web application. So this gem gives that capabilities with a feature to integrate google analytics.'
spec.homepage = 'https://github.com/fidenz-developer/fi-seo.git'
spec.license = 'MIT'
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')

Expand Down
Binary file added screenshots/dynamic-pages-seoable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/static-pages-seoable-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/static-pages-seoable-frontend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/static-pages-seoable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e4d9c04

Please sign in to comment.