Class: Octopress::Docs::Page
- Inherits:
-
Jekyll::Page
- Object
- Jekyll::Page
- Octopress::Docs::Page
- Includes:
- Jekyll::Convertible
- Defined in:
- lib/octopress-docs/page.rb
Instance Method Summary collapse
- #destination(dest) ⇒ Object
- #hooks ⇒ Object
-
#initialize(site, base, dir, name, config = {}) ⇒ Page
constructor
Purpose: Configs can override a page’s permalink.
- #relative_asset_path ⇒ Object
-
#url ⇒ Object
Allow pages to read url from plugin configuration.
Constructor Details
#initialize(site, base, dir, name, config = {}) ⇒ Page
Purpose: Configs can override a page’s permalink
url - Path relative to destination directory.
examples:
- '/' for the _site/index.html page
- '/archive/' for the _site/archive/index.html page
13 14 15 16 17 |
# File 'lib/octopress-docs/page.rb', line 13 def initialize(site, base, dir, name, config={}) @config = config super(site, base, dir, name) post_init if respond_to?(:post_init) end |
Instance Method Details
#destination(dest) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/octopress-docs/page.rb', line 23 def destination(dest) unless @dest if @config['path'] dest = File.join(dest, @config['path']) end @dest = File.join(dest, self.url) end @dest end |
#hooks ⇒ Object
19 20 21 |
# File 'lib/octopress-docs/page.rb', line 19 def hooks self.site.page_hooks end |
#relative_asset_path ⇒ Object
33 34 35 36 37 |
# File 'lib/octopress-docs/page.rb', line 33 def relative_asset_path site_source = Pathname.new Octopress.site.source page_source = Pathname.new @base page_source.relative_path_from(site_source).to_s end |
#url ⇒ Object
Allow pages to read url from plugin configuration
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/octopress-docs/page.rb', line 41 def url unless @url super if @url && @url =~ /\/$/ ext = (self.ext == '.xml'? 'xml' : 'html') @url = File.join(@url, "index.#{ext}") end end @url end |