https://github.com/yuya-matsushima/middleman-robots
middleman-robots is extension of Middleman. This extension create robots.txt by config.rb.
https://github.com/yuya-matsushima/middleman-robots
middleman middleman-extension rubygems
Last synced: 5 months ago
JSON representation
middleman-robots is extension of Middleman. This extension create robots.txt by config.rb.
- Host: GitHub
- URL: https://github.com/yuya-matsushima/middleman-robots
- Owner: yuya-matsushima
- License: mit
- Created: 2014-12-09T16:37:04.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2022-12-31T13:31:33.000Z (over 2 years ago)
- Last Synced: 2024-12-01T10:18:22.665Z (6 months ago)
- Topics: middleman, middleman-extension, rubygems
- Language: Ruby
- Homepage:
- Size: 72.3 KB
- Stars: 33
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.jp.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Middleman::Robots
[](http://badge.fury.io/rb/middleman-robots)
[](https://travis-ci.org/yterajima/middleman-robots)`middleman-robots` は [Middleman](http://middlemanapp.com/) の拡張機能です。 `config.rb` に記述されたルールに基いて `robots.txt` を作ります。
## Installation
Gemfile に次の行を追加してください:
```ruby
gem 'middleman-robots'
```コマンドを実行します:
$ bundle
Gemfile を使わずにインストールする場合は次のコマンドを実行してください:
$ gem install middleman-robots
## 使い方
基本的な使い方です:
```ruby
# config.rb
activate :robots,
:rules => [
{:user_agent => '*', :allow => %w(/)}
],
:sitemap => "http://example.com/sitemap.xml"
```作成される `robots.txt`:
```
User-Agent: *
Allow: /Sitemap: http://example.com/sitemap.xml
```
オプションには `:rules` [{`:user_agent`(string), `:allow`(array), `:disallow`(array)}] と `:sitemap` を指定できます。すべてのオプションを指定すると次のようになります:
```ruby
# config.rb
activate :robots,
:rules => [
{
:user_agent => 'Googlebot',
:disallow => %w(tmp/ /something/dir/file_disallow.html),
:allow => %w(allow/ /something/dir/file_allow.html)
},
{
:user_agent => 'Googlebot-Image',
:disallow => %w(tmp/ /something/dir/file_disallow.html),
:allow => %w(allow/ /something/dir/file_allow.html)
}
],
:sitemap => "http://example.com/sitemap.xml"
```作成される `robots.txt`:
```
User-Agent: Googlebot
Disallow: /tmp/
Disallow: /something/dir/file_disallow.html
Allow: /allow/
Allow: /something/dir/file_allow.htmlUser-Agent: Googlebot-Image
Disallow: /tmp/
Disallow: /something/dir/file_disallow.html
Allow: /allow/
Allow: /something/dir/file_allow.htmlSitemap: http://example.com/sitemap.xml
```
## Contributing
1. Fork it ( https://github.com/yterajima/middleman-robots/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request