diff --git a/app/models/communication/website/github_file.rb b/app/models/communication/website/github_file.rb index 5abf9b06c0c354b62432fffc835d0623620bff5d..e173927eece776d364d3961e9317c380585989e3 100644 --- a/app/models/communication/website/github_file.rb +++ b/app/models/communication/website/github_file.rb @@ -106,7 +106,7 @@ class Communication::Website::GithubFile < ApplicationRecord end def github_blob_path(blob) - "_data/media/#{blob.id[0..1]}/#{blob.id}.yml" + "data/media/#{blob.id[0..1]}/#{blob.id}.yml" end def github_commit_message diff --git a/app/models/communication/website/menu.rb b/app/models/communication/website/menu.rb index 30314168f31f288b600791b93986f183364c01f3..25eee954061c43c4a7cbfb0f1206b53536054ec7 100644 --- a/app/models/communication/website/menu.rb +++ b/app/models/communication/website/menu.rb @@ -41,7 +41,7 @@ class Communication::Website::Menu < ApplicationRecord # Override from WithGithubFiles def github_path_generated - "_data/menus/#{identifier}.yml" + "data/menus/#{identifier}.yml" end def to_static(github_file) diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index ca9db8019743096944cb54eed3c52edf12ef8ac3..912f6e30aa3445c0eb6e75d0be75ea3fe5e8071e 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -65,12 +65,12 @@ class Communication::Website::Post < ApplicationRecord def path # used in menu_item#static_target - "/#{website.posts_github_directory}/#{published_at.strftime "%Y/%m/%d"}/#{slug}" + "/#{website.posts_github_directory}/#{published_at.strftime "%Y/%m/%d"}/#{slug}/" end # Override from WithGithubFiles def github_path_generated - "_posts/#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}.html" + "content/posts/#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}.html" end def to_s diff --git a/app/models/concerns/with_slug.rb b/app/models/concerns/with_slug.rb index 7d0f703c42d5a37cb6d3ebb9a319f08b8de009fb..f0e773ec712b956dfa26ecf780d05ac731d10339 100644 --- a/app/models/concerns/with_slug.rb +++ b/app/models/concerns/with_slug.rb @@ -28,7 +28,7 @@ module WithSlug end def make_path - return unless respond_to? :path + return unless respond_to?(:path) && respond_to?(:parent) self.path = "#{parent&.path}/#{slug}".gsub(/\/+/, '/') end end diff --git a/app/views/admin/communication/website/posts/static.html.erb b/app/views/admin/communication/website/posts/static.html.erb index 94a08c8776e4ad88d1084da0a585f85b0ac31a43..6fca22570eb3c991c236badeb8dde7d287ae7f5b 100644 --- a/app/views/admin/communication/website/posts/static.html.erb +++ b/app/views/admin/communication/website/posts/static.html.erb @@ -2,25 +2,22 @@ title: "<%= @post.title %>" date: <%= @post.published_at %> UTC slug: "<%= @post.slug %>" -pinned: <%= @post.pinned %> -author: "<%= @post.author_id %>" +<% if @post.pinned %> +weight: 1 +<% end %> +authors: + - "<%= @post.author.slug %>" <% if @post.categories.any? %> categories: <% @post.categories.each do |category| %> - - "<%= category.id %>" + - "<%= category.path %>" <% end %> <% end %> -<% if @post.author_id.present? %> -tags: - - "<%= @post.author_id %>" -<% end %> <% if @post.featured_image.attached? %> image: "<%= @post.featured_image.blob.id %>" image_alt: "<%= @post.featured_image_alt %>" <% end %> description: > - <%= prepare_for_github @post.description, @post.university %> -text: > - <%= prepare_for_github @post.text, @post.university %> + <%= @post.description.chomp %> --- -<%= @github_file.github_frontmatter.content.html_safe %> +<%= prepare_for_github @post.text, @post.university %>