Skip to content

Commit

Permalink
Make index layouts actual html content. And remove preprocessor
Browse files Browse the repository at this point in the history
Signed-off-by: Crola1702 <[email protected]>
  • Loading branch information
Crola1702 committed Aug 16, 2024
1 parent 9d0eef7 commit 5bc43c5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 51 deletions.
39 changes: 3 additions & 36 deletions Rules
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/usr/bin/env ruby

preprocess do
projects = @items.find_all '/projects/*.md'
members = @items.find_all '/team/*.md'

# Add index extra data
index = @items['/index.md']
index[:projects] = projects
index[:members] = members

@items.create('', { projects: projects }, '/projects/index.html')
@items.create('', { members: members }, '/team/index.html')
@items.create('', { projects: projects }, '/documentation/index.html')
@items.create('', {}, '/repos/index.html')
end

# Individual pages
compile '/projects/*.md' do
filter :kramdown
Expand All @@ -36,28 +21,10 @@ compile '/repos/*.md' do
end

# Index pages
compile '/projects/index.html' do
layout '/projects-all.erb'
layout '/default.erb'
write item.identifier
end

compile '/team/index.html' do
layout '/team.erb'
layout '/default.erb'
write item.identifier
end

compile '/documentation/index.html' do
layout '/documentation.erb'
layout '/default.erb'
write item.identifier
end

compile '/repos/index.html' do
layout '/repos.erb'
compile '/**/index.html.erb' do
filter :erb
layout '/default.erb'
write item.identifier
write item.identifier.without_ext
end

compile '/index.md' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>Check the documentation</h1>
<div class="col-xs-12 col-sm-6 col-md-4">
<ul>
<% @item[:projects].each do |project| %>
<% @items.find_all('/projects/*.md').each do |project| %>
<li><a href="<%= project[:docs_url] %>"><%= project[:title] %> Documentation</a></li>
<% end %>
</ul>
Expand Down
11 changes: 0 additions & 11 deletions content/documentations.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<h1>Our projects</h1>
<% @item[:projects].each do |project| %>
<% @items.find_all('/projects/*.md').each do |project| %>
<div class="col-xs-12 col-sm-6 col-md-4 py-2">
<div class="card">
<a href="<%= project.identifier.without_ext %>">
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion layouts/team.erb → content/team/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<h1>Our Team</h1>
<% @item[:members].each do |member| %>
<% @items.find_all('/team/*.md').each do |member| %>
<div class="col-xs-12 col-sm-6 col-md-4 py-2">
<div class="card">
<a href="<%= member.identifier.without_ext %>">
Expand Down
2 changes: 1 addition & 1 deletion layouts/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<div class="row">
<h1>Our projects</h1>
<% @item[:projects].each do |project| %>
<% @items.find_all('/projects/*.md').each do |project| %>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="card">
<a href="<%= project.identifier.without_ext %>">
Expand Down

0 comments on commit 5bc43c5

Please sign in to comment.