Skip to content

Commit

Permalink
Hide files that don't have status Published in their frontmatter
Browse files Browse the repository at this point in the history
We use a ready hook in the config.rb to scan through the sitemap and explicitly ignore any files without frontmatter that sets them as published.  We also explicitly keep .htaccess files and anything taht looks like an asset (for now that's anything in javascripts/, stylesheets/, or images/).

I guess this is laying some groundwork to make #18 and #19 more worthwhile.
  • Loading branch information
h-lame committed Jan 8, 2015
1 parent 7bc0fdb commit dd52ff6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,13 @@
years.each do |year|
proxy "/meetings/#{year}/index.html", "/meetings/meetings_index.html", locals: { year: year }, ignore: true
end

ready do
sitemap.resources.
reject { |r| r.data.status && r.data.status == 'Published' }. # keep published files
reject { |r| r.path =~ %r{(javascripts|images|stylesheets)/} }. # and assets
reject { |r| r.path =~ %r{\.htaccess\Z} }. # and .htaccess files
each do |unpublished|
ignore unpublished.path
end
end
4 changes: 4 additions & 0 deletions source/meetings/meetings_index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
status: 'Published'
---

<%
meetings = meeting_pages.select { |page| page.path.include? "/#{locals[:year]}/" }
content_for(:title) { "#{locals[:year]} Meetings" }
Expand Down
3 changes: 3 additions & 0 deletions source/rss/template.rss.builder
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
status: Published
---
articles = pages_in_category(category).take(10)
site_url = "http://lrug.org/"

Expand Down

0 comments on commit dd52ff6

Please sign in to comment.