Class: Octopress::Docs::Page
- Inherits:
-
Jekyll::Page
- Object
- Jekyll::Page
- Octopress::Docs::Page
- Includes:
- Convertible
- Defined in:
- lib/octopress/docs/jekyll/page.rb
Instance Method Summary collapse
- #destination(dest) ⇒ 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.
Methods included from Convertible
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/jekyll/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
19 20 21 22 23 24 25 26 27 |
# File 'lib/octopress/docs/jekyll/page.rb', line 19 def destination(dest) unless @dest if @config['path'] dest = File.join(dest, @config['path']) end @dest = File.join(dest, self.url) end @dest end |
#relative_asset_path ⇒ Object
29 30 31 32 33 |
# File 'lib/octopress/docs/jekyll/page.rb', line 29 def relative_asset_path site_source = Pathname.new Docs.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
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/octopress/docs/jekyll/page.rb', line 37 def url unless @url super if @url && @url =~ /\/$/ ext = (self.ext == '.xml'? 'xml' : 'html') @url = File.join(@url, "index.#{ext}") end end @url end |