Skip to content
Snippets Groups Projects
Commit b75319e6 authored by pabois's avatar pabois
Browse files

force path without languages in permalinks config

parent 27e8ced8
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,14 @@ class Communication::Website::Page < ApplicationRecord
"#{parent&.path}#{slug}/".gsub(/\/+/, '/')
end
def path_without_language
if parent_id.present?
"#{parent&.path_without_language}#{slug}/".gsub(/\/+/, '/')
else
"/#{slug}/".gsub(/\/+/, '/')
end
end
def git_path(website)
return unless published
if kind_home?
......
<% if @website.has_communication_posts? %>
posts: <%= @website.special_page(:communication_posts).path %>/:year/:month/:day/:slug/
posts: <%= @website.special_page(:communication_posts).path_without_language %>/:year/:month/:day/:slug/
<% end %>
<% if @website.has_communication_categories? %>
categories: <%= @website.special_page(:communication_posts).path %>/:slug/
categories: <%= @website.special_page(:communication_posts).path_without_language %>/:slug/
<% end %>
<% if @website.has_persons? %>
persons: <%= @website.special_page(:persons).path %>/:slug/
persons: <%= @website.special_page(:persons).path_without_language %>/:slug/
<% end %>
<% if @website.has_authors? %>
authors: <%= @website.special_page(:persons).path %>/:slug/<%= @website.special_page(:communication_posts).slug %>/
authors: <%= @website.special_page(:persons).path_without_language %>/:slug/<%= @website.special_page(:communication_posts).slug %>/
<% end %>
<%# ces paths complémentaires sont nécessairesà Hugo mais on ne les utilise pas %>
<% if @website.has_administrators? %>
administrators: <%= @website.special_page(:persons).path %>/:slug/roles/
administrators: <%= @website.special_page(:persons).path_without_language %>/:slug/roles/
<% end %>
<% if @website.has_teachers? %>
teachers: <%= @website.special_page(:persons).path %>/:slug/programs/
teachers: <%= @website.special_page(:persons).path_without_language %>/:slug/programs/
<% end %>
<% if @website.has_researchers? %>
researchers: <%= @website.special_page(:persons).path %>/:slug/articles/
researchers: <%= @website.special_page(:persons).path_without_language %>/:slug/articles/
<% end %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment