Advertisement
Guest User

my config.rb

a guest
Feb 8th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.36 KB | None | 0 0
  1. ###
  2. # Page options, layouts, aliases and proxies
  3. ###
  4.  
  5. # Per-page layout changes:
  6. #
  7. # With no layout
  8. page "/*.xml", layout: false
  9. page "/*.json", layout: false
  10. page "/*.txt", layout: false
  11.  
  12. # With alternative layout
  13. # page "/path/to/file.html", layout: :otherlayout
  14. page "posts/*", :layout => :article_layout
  15.  
  16. # Proxy pages (http://middlemanapp.com/basics/dynamic-pages/)
  17. # proxy "/this-page-has-no-template.html", "/template-file.html", locals: {
  18. #  which_fake_page: "Rendering a fake page with a local variable" }
  19.  
  20. ###
  21. # Set variables
  22. ###
  23. set :css_dir, "source/css"
  24. set :js_dir, "source/js"
  25. set :markdown_engine, :redcarpet
  26. set :markdown, :fenced_code_blocks => true, :smartypants => true
  27.  
  28. ###
  29. # Extensions
  30. ###
  31. activate :directory_indexes
  32. activate :syntax, :line_numbers => true
  33.  
  34. ###
  35. # Helpers
  36. ###
  37.  
  38. activate :blog do |blog|
  39.   # This will add a prefix to all links, template references and source paths
  40.   # blog.prefix = "posts"
  41.   blog.permalink = "posts/{year}-{month}-{day}-{title}.html"
  42.   blog.layout = "article_layout"
  43.   # Matcher for blog source files
  44.   blog.sources = "posts/{year}-{month}-{day}-{title}.html"
  45.   blog.taglink = "categories/{tag}.html"
  46.   # blog.layout = "layout"
  47.   blog.summary_separator = /(READMORE)/
  48.   blog.summary_length = 250
  49.   # blog.year_link = "{year}.html"
  50.   # blog.month_link = "{year}/{month}.html"
  51.   # blog.day_link = "{year}/{month}/{day}.html"
  52.   # blog.default_extension = ".markdown"
  53.  
  54.   blog.tag_template = "tag.html"
  55.   blog.calendar_template = "calendar.html"
  56.  
  57.   # Enable pagination
  58.   blog.paginate = true
  59.   blog.per_page = 5
  60.   blog.page_link = "page/{num}"
  61. end
  62.  
  63. page "/feed.xml", layout: false
  64. # Reload the browser automatically whenever files change
  65. configure :development do
  66.   set :debug_assets, true
  67. end
  68.  
  69. # Methods defined in the helpers block are available in templates
  70. helpers do
  71.   def home_link
  72.     link_to "Home", config[:host]
  73.   end
  74. end
  75.  
  76. # Build-specific configuration
  77. configure :build do
  78.   config[:host] = "https://alec-stewart.xyz"
  79.  
  80.   # Minify CSS on build
  81.   activate :minify_css
  82.  
  83.   # Minify Javascript on build
  84.   require "uglifier"
  85.   activate :minify_javascript, compressor: proc {
  86.                         ::Uglifier.new(:harmony => true, :mangle => {:toplevel => true}, :compress => {:unsafe => true})
  87.                       }
  88.   # Minify HTML on build
  89.   activate :minify_html
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement