diff --git a/app/models/communication/website/category.rb b/app/models/communication/website/category.rb index a00ecbed67f334488394e52bd07426ad5069b111..3f378dcb0c0f7130b6ba06dac72eb44d30984485 100644 --- a/app/models/communication/website/category.rb +++ b/app/models/communication/website/category.rb @@ -81,7 +81,7 @@ class Communication::Website::Category < ApplicationRecord end def git_path(website) - "content/categories/#{path}/_index.html" + "content/categories/#{slug_with_ancestors_slugs}/_index.html" end def template_static @@ -108,7 +108,7 @@ class Communication::Website::Category < ApplicationRecord end def slug_with_ancestors_slugs - (ancestors.map(&:slug) << slug).join('/') + (ancestors.map(&:slug) << slug).join('-') end protected diff --git a/app/views/admin/application/static/_permalink.html.erb b/app/views/admin/application/static/_permalink.html.erb index 754eaa1494af7cc093f36fea65662eb14c76a1a0..0566d251fe5b99069ba4d6a4540fd2c030a97a56 100644 --- a/app/views/admin/application/static/_permalink.html.erb +++ b/app/views/admin/application/static/_permalink.html.erb @@ -1,6 +1,6 @@ url: "<%= @about.current_permalink_in_website(@website)&.path %>" <% if @about.respond_to?(:slug) && @about.slug.present? %> -slug: "<%= @about.slug %>" +slug: "<%= forced_slug || @about.slug %>" <% end %> <% previous_permalinks = @about.previous_permalinks_in_website(@website).where.not(path: "/") diff --git a/app/views/admin/communication/websites/categories/static.html.erb b/app/views/admin/communication/websites/categories/static.html.erb index 22040b310c562e164dff04f54085610a5f9067b2..482d80b62b7a80336531551cd852640bef6ac796 100644 --- a/app/views/admin/communication/websites/categories/static.html.erb +++ b/app/views/admin/communication/websites/categories/static.html.erb @@ -1,9 +1,15 @@ --- title: "<%= @about.name %>" -<%= render 'admin/application/static/permalink' %> +<%= render 'admin/application/static/permalink', forced_slug: @about.slug_with_ancestors_slugs %> <% if @about.parent %> parent: "<%= @about.parent.path %>" <% end %> +<% if @about.children.any? %> +children: +<% @about.children.ordered.each do |child| %> + - <%= child.path %> +<% end %> +<% end %> position: <%= @about.position %> <%= render 'admin/communication/unsplash/static' %> description: >