fixed links between sites, turned into site.name (mostly)
parent
b3fd539f21
commit
15905b1cf1
|
@ -21,11 +21,11 @@ module Nanoc::CLI::Commands
|
|||
next if i.shared?
|
||||
end
|
||||
|
||||
page_links << "[#{i[:title]}]: #{i.identifier}"
|
||||
page_links << site_link(i[:title], i.identifier, current_site)
|
||||
|
||||
unless i[:alt_titles].nil?
|
||||
i[:alt_titles].each do |title|
|
||||
page_links << "[#{title}]: #{i.identifier}"
|
||||
page_links << site_link(title, i.identifier, current_site)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -33,6 +33,10 @@ module Nanoc::CLI::Commands
|
|||
page_links
|
||||
end
|
||||
|
||||
def site_link title, link, site
|
||||
"[#{title}]: " + site.url + link
|
||||
end
|
||||
|
||||
def duplicate_links
|
||||
references = []
|
||||
|
||||
|
|
|
@ -15,9 +15,13 @@ site_cmds = [
|
|||
# site-specific config
|
||||
module ::Nanoc
|
||||
class Site
|
||||
attr_accessor :name
|
||||
|
||||
def extended_build_config(dir_or_config_hash, site)
|
||||
puts "load extended config..."
|
||||
|
||||
@name = site
|
||||
|
||||
@config[:output_dir] = "out/#{site}"
|
||||
|
||||
@config[:data_sources] = [{
|
||||
|
@ -50,7 +54,7 @@ module ::Nanoc
|
|||
end
|
||||
|
||||
def main_site?
|
||||
$site == "muflax"
|
||||
@name == "muflax"
|
||||
end
|
||||
|
||||
def blog?
|
||||
|
@ -60,7 +64,7 @@ module ::Nanoc
|
|||
def disqus_site
|
||||
# TODO merge them all?
|
||||
# site -> disqus shortname
|
||||
case $site
|
||||
case @name
|
||||
when "muflax"
|
||||
"muflax"
|
||||
when "sutra"
|
||||
|
@ -75,7 +79,7 @@ module ::Nanoc
|
|||
end
|
||||
|
||||
def url
|
||||
"http://#{main_site? ? "" : "#{$site}."}muflax.com"
|
||||
"http://#{main_site? ? "" : "#{@name}."}muflax.com"
|
||||
end
|
||||
|
||||
def disqus_url item
|
||||
|
@ -83,7 +87,7 @@ module ::Nanoc
|
|||
end
|
||||
|
||||
def title
|
||||
case $site
|
||||
case @name
|
||||
when "muflax"
|
||||
"lies and wonderland"
|
||||
when "sutra"
|
||||
|
|
|
@ -6,13 +6,13 @@ def image(name, title="", link=nil)
|
|||
ret = ""
|
||||
|
||||
# read image size
|
||||
img = ImageSize.new IO.read("content_#{$site}/pigs/#{name}")
|
||||
img = ImageSize.new IO.read("content_#{@site.name}/pigs/#{name}")
|
||||
|
||||
# if it's too large, redirect to smaller version (which is generated with 'nanoc images')
|
||||
if img.width > 400 and not name.end_with? ".gif"
|
||||
link = "/pigs/#{name}" if link.nil? # link to big version
|
||||
name.gsub! /^(.+)\.(\w+)$/, '\1_small.\2'
|
||||
img = ImageSize.new IO.read("content_#{$site}/pigs/#{name}") # re-read image
|
||||
img = ImageSize.new IO.read("content_#{@site.name}/pigs/#{name}") # re-read image
|
||||
end
|
||||
|
||||
ret += "<a href='#{link}'>" unless link.nil?
|
||||
|
|
Loading…
Reference in New Issue