Class: Abqari::PublisherPages

Inherits:
Object
  • Object
show all
Defined in:
lib/abqari/publisher_pages.rb

Overview

Auto-generates index + show pages for publications, bundles, and series whose data comes from an external publisher integration (currently Folio — apps/folio — with the door open for others that emit canonical-shape data per docs/publications.md).

Runs only when folio: config is set (today). Each generated page can be overridden by creating a markdown file at the matching path (e.g. content/publications/<slug>/index.md); the engine skips auto-generation for any URL that already has a Page from content/. The override page wins on slug collision.

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ PublisherPages

Returns a new instance of PublisherPages.



17
18
19
# File 'lib/abqari/publisher_pages.rb', line 17

def initialize(site)
  @site = site
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/abqari/publisher_pages.rb', line 21

def enabled?
  @site.config['folio'].is_a?(Hash) && !@site.config['folio'].empty?
end

#pagesObject

Returns auto-generated pages: up to three index pages (publications / bundles / series) and one show page per externally-sourced publication, bundle, and series.



28
29
30
31
32
33
34
35
36
37
# File 'lib/abqari/publisher_pages.rb', line 28

def pages
  return [] unless enabled?

  result = []
  result.concat(index_pages)
  result.concat(publication_pages)
  result.concat(bundle_pages)
  result.concat(series_pages)
  result
end