Sha256: 56eccdf8d071f9fa0be6ec0c181c4b7944cf3271c12938e14d0451540e158d9b
Contents?: true
Size: 1.38 KB
Versions: 94
Compression:
Stored size: 1.38 KB
Contents
class ExtendController < ApplicationController before_action :set_navigation def index document_paths = Dir.glob("#{Rails.configuration.docs_base_path}/_extend/**/*.md") @extensions = document_paths.map do |document_path| document = File.read(document_path) frontmatter = YAML.safe_load(document) next unless frontmatter['published'] title = frontmatter['title'] description = frontmatter['description'] tags = frontmatter['tags'] || [] image = frontmatter['image'] || '' route = File.basename(document_path, '.*') { title: title, description: description, tags: tags, image: image, route: route } end.compact render layout: 'landing' end def show document_path = "#{Rails.configuration.docs_base_path}/_extend/#{params[:title]}.md" document = File.read(document_path) body = Nexmo::Markdown::Renderer.new.call(document) frontmatter = YAML.safe_load(document) title = frontmatter['title'] description = frontmatter['description'] tags = frontmatter['tags'] || [] image = frontmatter['image'] || '' cta = frontmatter['cta'] || 'Use This' link = frontmatter['link'] || '' @extension = { title: title, body: body, image: image, description: description, tags: tags, link: link, cta: cta } render layout: 'page' end private def set_navigation @navigation = :extend end end
Version data entries
94 entries across 94 versions & 1 rubygems