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

fix meta_tag #146

Merged
merged 2 commits into from
Sep 21, 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: 4 additions & 0 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def index
def show
@event = Event.find(params[:id])
@facility = @event.facility
set_meta_tags(
title: @event.title,
keywords: "#{@event.name},#{@event.address},#{@event.target_age},#{@event.environment},#{@event.request}"
)
end

def autocomplete
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/facilities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ def index
def show
@facility = Facility.find(params[:id])
@place = @facility.place
# メタタグ
set_meta_tags(
title: @facility.title,
keywords: "#{@facility.name},#{@facility.address},#{@facility.target_age},#{@facility.environment},#{@facility.facility_url}"
)
end

def bookmarks
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/playground_equipments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ def index
def show
@playground_equipment = PlaygroundEquipment.find(params[:id])
@facility = @playground_equipment.facility
set_meta_tags(
title: @playground_equipment.title,
keywords: "#{@playground_equipment.kind},#{@playground_equipment.target_age},#{@playground_equipment.remarks}"
)
end
end
3 changes: 3 additions & 0 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ def index

def terms_of_use
end

def privacy_policy
end
end
4 changes: 3 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<head>
<title>よちよち</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="<%= yield(:description) ||"よちよち, yochiyochi, 赤ちゃん・幼児向け施設・イベント情報検索サービス" %>">
<meta name="keywords" content="<%= yield(:keywords) || "施設, イベント, 子ども, 屋内, 屋外" %>">
<meta name="google-site-verification" content="tUgVKLHlos_Ub0yX4FxM-8D1WpJONQB5BFs2qEltuBM" />
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
Expand All @@ -12,7 +14,7 @@
<link href="https://fonts.googleapis.com/css2?family=Hachi+Maru+Pop&family=M+PLUS+Rounded+1c:wght@100;300;400;500;700;800;900&display=swap" rel="stylesheet">
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= stylesheet_link_tag 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css', integrity: 'sha384-jLKHWM6HEW8klhZC3sh5orLukbN5PdJ5ybzU8mP32F1yBdC0jHaT2nFjB9COgucL', crossorigin: 'anonymous' %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module", defer: true %>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>
<!-- Google tag (gtag.js) -->
Expand Down
8 changes: 4 additions & 4 deletions app/views/shared/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<%= link_to "施設一覧", facilities_path, class:"nav-link active" %>
<%= link_to "イベント一覧", events_path, class:"nav-link active" %>
<%= link_to '問い合わせ','https://docs.google.com/forms/d/e/1FAIpQLSeMWLzuaz2_GmcI_bxL3rbYwFuRaLuLA1M-fI-TImID8-RQOw/viewform?embedded=true', class:'nav-link active' %>
<%= link_to "利用規約", "static_pages/terms_of_use", class:"nav-link active" %>
<%= link_to 'プライバシーポリシー','static_pages/privacy_policy', class:'nav-link active ' %>
<%= link_to "利用規約", terms_of_use_path, class:"nav-link active " %>
<%= link_to 'プライバシーポリシー',privacy_policy_path, class:'nav-link active ' %>
</div>
</div>
</div>
Expand All @@ -55,8 +55,8 @@
<%= link_to "施設一覧", facilities_path, class:"nav-link active" %>
<%= link_to "イベント一覧", events_path, class:"nav-link active" %>
<%= link_to '問い合わせ','https://docs.google.com/forms/d/e/1FAIpQLSeMWLzuaz2_GmcI_bxL3rbYwFuRaLuLA1M-fI-TImID8-RQOw/viewform?embedded=true', class:'nav-link active' %>
<%= link_to "利用規約", "static_pages/terms_of_use", class:"nav-link active " %>
<%= link_to 'プライバシーポリシー','static_pages/privacy_policy', class:'nav-link active ' %>
<%= link_to "利用規約", terms_of_use_path, class:"nav-link active " %>
<%= link_to 'プライバシーポリシー',privacy_policy_path, class:'nav-link active ' %>
</div>
</div>
</div>
Expand Down
35 changes: 3 additions & 32 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@
# get '/logout', to: 'user_sessions#destroy'
delete 'logout', to: 'user_sessions#destroy'
root 'static_pages#index'

get 'static_pages/index'
get 'static_pages/terms_of_use', to: 'static_pages#terms_of_use'
get 'static_pages/privacy_policy', to: 'static_pages#privacy_policy'
get 'terms_of_use', to: 'static_pages#terms_of_use'
get 'privacy_policy', to: 'static_pages#privacy_policy'
get 'users/:id/reviews', to: 'reviews#user_reviews', as: 'user_reviews'
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

Expand All @@ -53,58 +52,30 @@
# delete 'logout' => 'user_sessions#destroy', :as => :logout
# end
resources :users, only: %i[new create show destroy withdraw]
# collection do
# get 'static_pages/terms_of_use'
# end
resources :reviews, only: %i[user_reviews]
resource :diagnostics, only: %i[new create]do
get :complete, on: :collection
collection do
get 'static_pages/terms_of_use'
end
end
resources :user_sessions, only: %i[new create destroy]
# collection do
# get 'static_pages/terms_of_use'
# end

resources :mypages, only: %i[index show edit update]
# collection do
# get 'static_pages/terms_of_use'
# end
resources :bookmarks, only: %i[index create destroy]
# collection do
# get 'static_pages/terms_of_use'
# end
resources :events do
get 'static_pages/terms_of_use', on: :member #idの取得が必要な場合
resources :reviews, only: %i[index show new create update destroy edit update] # 必要なアクションのみを指定する
get 'static_pages/terms_of_use', on: :member
collection do
get :bookmarks, only: %i[index create destroy]
get :autocomplete
get 'static_pages/terms_of_use'
end
end
resources :facilities, only: %i[index show new create update destroy] do

collection do
get :bookmarks, only: %i[index create destroy]
get :autocomplete
get 'static_pages/terms_of_use'
end
resources :playground_equipments, only: %i[index show],shallow: true
collection do
get 'static_pages/terms_of_use'
end
resources :reviews, only: %i[index new show create destroy edit update] # 必要なアクションのみを指定する
collection do
get 'static_pages/terms_of_use'
end
end
resources :autocomplete, only: %i[index]
resources :password_resets, only: %i[new create edit update]
resources :recommendations, only: %i[index]
# collection do
# get 'static_pages/terms_of_use'
# end
end
Loading