Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sitemap #141

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ gem 'font-awesome-rails'
#OGP
gem 'meta-tags'

# gem 'omniauth'
# gem 'omniauth-google-oauth2' #GoogleのOAuth
#SEO(サイトマップ)
gem 'sitemap_generator'


group :development, :test do
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sitemap_generator (6.3.0)
builder (~> 3.0)
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
Expand Down Expand Up @@ -476,6 +478,7 @@ DEPENDENCIES
rspec-rails
sassc-rails
selenium-webdriver
sitemap_generator
sorcery
sprockets-rails
sqlite3 (~> 1.4)
Expand Down
64 changes: 64 additions & 0 deletions config/sitemap.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "https://yochiyochi.onrender.com/"
SitemapGenerator::Sitemap.sitemaps_host = "https://#{ENV['AWS_S3_BUCKET']}.s3.amazonaws.com/"
SitemapGenerator::Sitemap.public_path = 'tmp/' # 一時保存用
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/' # S3上の保存ディレクトリ
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new


SitemapGenerator::Sitemap.create do
# Put links creation logic here.
#
# The root path '/' and sitemap index file are added automatically for you.
# Links are added to the Sitemap in the order they are specified.
#
# Usage: add(path, options={})
# (default options are used if you don't specify)
#
# Defaults: :priority => 0.5, :changefreq => 'weekly',
# :lastmod => Time.now, :host => default_host
#
# Examples:
#
# Add '/articles'
#
# add articles_path, :priority => 0.7, :changefreq => 'daily'
#トップページ
add '/', :priority => 1.0, :changefreq => 'dialy'

#施設一覧
add 'facilities_path', :priority => 0.8, :changefreq => 'dialy'

#イベント一覧
add 'events_path', :priority => 0.8, :changefreq => 'dialy'

#問い合わせ
add 'https://docs.google.com/forms/d/e/1FAIpQLSeMWLzuaz2_GmcI_bxL3rbYwFuRaLuLA1M-fI-TImID8-RQOw/viewform?embedded=true',
:priority => 0.5,
:changefreq => 'dialy'
#利用規約
#プライバシーポリシー

#
# Add all articles:
#
# Article.find_each do |article|
# add article_path(article), :lastmod => article.updated_at
# end

#施設詳細
Facility.find_each do |facility|
add facility_path(facility),
:changefreq => 'dialy',
:priority => 0.9,
:lastmod => facility.updated_at
end

#イベント詳細
Event.find_each do |event|
add event_path(event),
:changefreq => 'dialy',
:priority => 0.9,
:lastmod => event.updated_at
end
end
Binary file added public/sitemaps/sitemap.xml.gz
Binary file not shown.
Loading