1
0
Fork 0
mirror of https://github.com/fmap/muflax65ngodyewp.onion synced 2024-06-18 09:16:48 +02:00

first step towards multiple sites

* multiple styles, layouts
* shared content
* central pigs
* conditional htaccess
* first half of multiple configs
This commit is contained in:
muflax 2012-04-11 12:04:41 +02:00
parent c1e44bd185
commit 0852e28e75
74 changed files with 114 additions and 10 deletions

22
Rules
View file

@ -44,7 +44,7 @@ preprocess do
def hide_pages
@items.each do |item|
if item.identifier.match %r{^/(style)/}
if item.identifier.match %r{^/(styles)/}
item[:is_hidden] = true
end
end
@ -56,7 +56,7 @@ preprocess do
reference_links
end
compile '/style/' do
compile '/styles/*' do
filter :sass, :syntax => :scss
end
@ -72,6 +72,10 @@ compile '/feed/' do
filter :erb
end
compile '/htaccess/' do
filter :erb
end
compile '*' do
if item.binary?
# don't filter binary items
@ -96,7 +100,13 @@ compile '*' do
end
# layout
layout 'default'
if blog?
layout 'blog'
else
layout 'default'
end
# clean up
filter :tidy
end
end
@ -109,15 +119,15 @@ route '/htaccess/' do
'/.htaccess'
end
route '/style/' do
'/style.css'
route '/styles/*' do
route_with_new_extension "css"
end
route '/references' do
# pass
end
# never compile /stuff
# never change /stuff
route '/stuff/*' do
route_unchanged
end

View file

@ -27,7 +27,7 @@ data_sources:
-
# The type is the identifier of the data source. By default, this will be
# `filesystem_unified`.
type: filesystem_unified
type: filesystem_customizable
# The path where items should be mounted (comparable to mount points in
# Unix-like systems). This is “/” by default, meaning that items will have
@ -40,6 +40,9 @@ data_sources:
# same as the items root, but applies to layouts rather than items.
layouts_root: /
# site-specific configs
source_dir: ["content_muflax"]
# Configuration for the “watch” command, which watches a site for changes and
# recompiles if necessary.
watcher:
@ -48,11 +51,11 @@ watcher:
# because recompiling the site will cause these directories to change, which
# will cause the site to be recompiled, which will cause these directories
# to change, which will cause the site to be recompiled again, and so on.
dirs_to_watch: [ 'content', 'layouts', 'lib' ]
dirs_to_watch: [ 'layouts', 'lib' ]
# A list of single files to watch for changes. As mentioned above, dont put
# any files from the “output/” or “tmp/” directories in here.
files_to_watch: [ 'config.yaml', 'Rules' ]
files_to_watch: [ 'Rules' ]
# When to send notifications (using Growl or notify-send).
notify_on_compilation_success: false

View file

@ -1,3 +1,8 @@
---
is_hidden: true
non_cognitive: true
---
# manual 404 page
ErrorDocument 404 /404/index.html
@ -7,6 +12,11 @@ RewriteEngine on
# don't alienate people who use the old feed
RewriteRule ^feed/? /rss.xml
<% unless main_site? %>
# store pigs in central site
RewriteRule ^pigs/(.+)$ http://muflax.com/pigs/$1 [L]
<% end %>
# serve gzipped files if available
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME} !\.gz$

View file

@ -0,0 +1,32 @@
---
title: Hitler Was Right
date: 2012-03-30
techne: :wip
episteme: :mindkiller
---
This article is *highly* political. It's firmly in mind-killing territory, and to some degree, contains outright trolling. You've been warned.
One of the most powerful weapons of a winning ideology is to define the framework of acceptable political debate. From *within* the framework, political debates seem wide and nuanced. From *without*, they are anything *but* - narrow, highly selective, barely distinguishable.
As a result, even controversial debates within the framework share virtually all their conclusions, and disagree mostly about priorities and justifications.
TODO example
Let's try *actual* political dissent: **Hitler was right**.
This must be a kind of novel position to argue, as even Neo-Nazis don't actually side with Hitler anymore. They are ideological pussies and an *offense to actual Nazism*[^hitlerist]. *No one* thinks Hitler had a point, but I think he did.
[^hitlerist]: That's right, I'm writing a *Hitlerist* criticism of Neo-Nazism. Doesn't happen much these days.
This position is so firmly off the charts, that I can't even invoke any reasonable disclaimer here. So let's just start and not worry about politics while I argue that Hitler was right.
# Hitler Was Right About Judaism
# Hitler Was Right About Bolshevism
# Hitler Was Right About Germany's Fate
# Hitler Was Right About His Role In History
If *anyone* counts as a Tragical Hero, it's *him*.

View file

@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><%= @item[:title] %></title>
<link rel="stylesheet" type="text/css" href="/style.css"/>
<link rel="stylesheet" type="text/css" href="/styles/default.css"/>
<meta name="generator" content="nanoc"/>
<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="lies and wonderland"/>
<!-- google analytics -->

View file

@ -49,6 +49,10 @@ def route_unchanged
item.identifier.chop + '.' + item[:extension]
end
def route_with_new_extension ext
item.identifier.chop + '.' + ext
end
def google_search
<<EOF
<div align="center"><form method="get" action="http://www.google.com/search">

View file

@ -1,6 +1,8 @@
require 'image_size'
def image(name, title="")
# all images are stored at content/pigs and only the main site routes them
img = ImageSize.new IO.read("content/pigs/#{name}")
"<img src='/pigs/#{name}' height='#{img.height}' width='#{img.width}' title='#{title}' alt='#{title}'/>"
end

View file

@ -0,0 +1,36 @@
module DataSources
# data_sources:
# -
# type: filesystem_customizable
# config:
# source_dir: ["src"]
# layout_dir: ["layouts", "other_layouts"]
class FilesystemCustomizable < Nanoc::DataSources::FilesystemUnified
identifier :filesystem_customizable
def setup
# Create directories
(@sources + @layouts).each { |dir| FileUtils.mkdir_p dir }
end
def items
@sources.map do |dir|
load_objects(dir, 'item', Nanoc::Item)
end.flatten
end
def layouts
@layouts.map do |dir|
load_objects(dir, 'layout', Nanoc::Layout)
end.flatten
end
def up
@sources = ['content'] + (config[:source_dir] || [])
@layouts = ['layouts'] + (config[:layout_dir] || [])
@dtstart = Time.now
end
def down
@dtend = Time.now
puts "Data loaded in #{format('%.2f', @dtend - @dtstart)}s."
end
end
end

7
lib/sites.rb Normal file
View file

@ -0,0 +1,7 @@
def main_site?
true
end
def blog?
false
end