Skip to content
Snippets Groups Projects
Commit 6ae32872 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

media and posts

parent 3c6cb681
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,7 @@ class Communication::Website::GithubFile < ApplicationRecord ...@@ -106,7 +106,7 @@ class Communication::Website::GithubFile < ApplicationRecord
end end
def github_blob_path(blob) def github_blob_path(blob)
"_data/media/#{blob.id[0..1]}/#{blob.id}.yml" "data/media/#{blob.id[0..1]}/#{blob.id}.yml"
end end
def github_commit_message def github_commit_message
......
...@@ -41,7 +41,7 @@ class Communication::Website::Menu < ApplicationRecord ...@@ -41,7 +41,7 @@ class Communication::Website::Menu < ApplicationRecord
# Override from WithGithubFiles # Override from WithGithubFiles
def github_path_generated def github_path_generated
"_data/menus/#{identifier}.yml" "data/menus/#{identifier}.yml"
end end
def to_static(github_file) def to_static(github_file)
......
...@@ -65,12 +65,12 @@ class Communication::Website::Post < ApplicationRecord ...@@ -65,12 +65,12 @@ class Communication::Website::Post < ApplicationRecord
def path def path
# used in menu_item#static_target # 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 end
# Override from WithGithubFiles # Override from WithGithubFiles
def github_path_generated 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 end
def to_s def to_s
......
...@@ -28,7 +28,7 @@ module WithSlug ...@@ -28,7 +28,7 @@ module WithSlug
end end
def make_path def make_path
return unless respond_to? :path return unless respond_to?(:path) && respond_to?(:parent)
self.path = "#{parent&.path}/#{slug}".gsub(/\/+/, '/') self.path = "#{parent&.path}/#{slug}".gsub(/\/+/, '/')
end end
end end
......
...@@ -2,25 +2,22 @@ ...@@ -2,25 +2,22 @@
title: "<%= @post.title %>" title: "<%= @post.title %>"
date: <%= @post.published_at %> UTC date: <%= @post.published_at %> UTC
slug: "<%= @post.slug %>" slug: "<%= @post.slug %>"
pinned: <%= @post.pinned %> <% if @post.pinned %>
author: "<%= @post.author_id %>" weight: 1
<% end %>
authors:
- "<%= @post.author.slug %>"
<% if @post.categories.any? %> <% if @post.categories.any? %>
categories: categories:
<% @post.categories.each do |category| %> <% @post.categories.each do |category| %>
- "<%= category.id %>" - "<%= category.path %>"
<% end %> <% end %>
<% end %> <% end %>
<% if @post.author_id.present? %>
tags:
- "<%= @post.author_id %>"
<% end %>
<% if @post.featured_image.attached? %> <% if @post.featured_image.attached? %>
image: "<%= @post.featured_image.blob.id %>" image: "<%= @post.featured_image.blob.id %>"
image_alt: "<%= @post.featured_image_alt %>" image_alt: "<%= @post.featured_image_alt %>"
<% end %> <% end %>
description: > description: >
<%= prepare_for_github @post.description, @post.university %> <%= @post.description.chomp %>
text: >
<%= prepare_for_github @post.text, @post.university %>
--- ---
<%= @github_file.github_frontmatter.content.html_safe %> <%= prepare_for_github @post.text, @post.university %>
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