Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ayushn21/bridgetown-sitemap
A Bridgetown plugin to generate a sitemap.xml
https://github.com/ayushn21/bridgetown-sitemap
bridgetown bridgetown-plugin sitemap sitemap-generator sitemap-xml
Last synced: 3 months ago
JSON representation
A Bridgetown plugin to generate a sitemap.xml
- Host: GitHub
- URL: https://github.com/ayushn21/bridgetown-sitemap
- Owner: ayushn21
- License: mit
- Created: 2021-05-05T21:22:19.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T15:18:06.000Z (over 1 year ago)
- Last Synced: 2024-10-03T09:55:02.606Z (4 months ago)
- Topics: bridgetown, bridgetown-plugin, sitemap, sitemap-generator, sitemap-xml
- Language: Ruby
- Homepage:
- Size: 298 KB
- Stars: 14
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Bridgetown Sitemap Generator Plugin
[![Tests](https://github.com/ayushn21/bridgetown-sitemap/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/ayushn21/bridgetown-sitemap/actions/workflows/tests.yml)
[![Gem Version](https://badge.fury.io/rb/bridgetown-sitemap.svg)](https://badge.fury.io/rb/bridgetown-sitemap)Bridgetown plugin to silently generate a sitemaps.org compliant sitemap for your Bridgetown site
## Usage
1. Install the plugin with the following command:
```shell
bundle add bridgetown-sitemap
```2. Add the following to your site's `config/initializers.rb`:
```ruby
Bridgetown.configure do |config|
config.url = "https://example.com" # the base hostname & protocol for your siteinit :"bridgetown-sitemap"
end
```## `` tag
The `` tag in the `sitemap.xml` will reflect by priority:1. A personalised date if you add the variable `last_modified_at:` with a date in the Front Matter. (*Dates need to be formatted as* `%Y-%m-%d %H:%M:%S %z`)
2. The modified date of the file as reported by `git log`.## `` and `` tag
You can optionally specify a _priority_ and _change frequency_ for each page in your site by adding the following to the Front Matter of each page:```yml
sitemap_priority: 0.7
sitemap_change_frequency: weekly
```This will add the following to the `` tag in the `sitemap.xml`:
```xml
0.7
weekly
```## Exclusions
If you would like to exclude specific pages from the sitemap set the
sitemap flag to `false` in the front matter for the page.```yml
sitemap: false
```To exclude multiple files, add a glob config to your `config/initializers.rb` file.
```ruby
Bridgetown.configure do |config|
# ...config.defaults << {
"scope" => { "path" => "assets/**/*.pdf" },
"values" => { "sitemap" => false }
}
end
```## Testing
* Run `bundle exec rake test` to run the test suite
* Or run `script/cibuild` to validate with Rubocop and run tests together.## Contributing
1. Fork it (https://github.com/ayushn21/bridgetown-sitemap/fork)
2. Clone the fork using `git clone` to your local development machine.
3. Create your feature branch (`git checkout -b my-new-feature`)
4. Commit your changes (`git commit -am 'Add some feature'`)
5. Push to the branch (`git push origin my-new-feature`)
6. Create a new Pull Request## License
Bridgetown Sitemap is released under the [MIT License](https://opensource.org/licenses/MIT).
Copyright © 2023 [Ayush Newatia](https://twitter.com/ayushn21)