ContentApp constructor

ContentApp({
  1. String directory = 'content',
  2. bool eagerlyLoadAllPages = false,
  3. bool enableFrontmatter = true,
  4. String dataDirectory = 'content/_data',
  5. TemplateEngine? templateEngine,
  6. List<PageParser> parsers = const [],
  7. List<PageExtension> extensions = const [],
  8. List<CustomComponent> components = const [],
  9. List<PageLayout> layouts = const [],
  10. ContentTheme? theme,
  11. bool debugPrint = false,
})

Creates a basic ContentApp that loads pages from the filesystem and applies the same configuration to all pages.

For a more customized setup, use ContentApp.custom.

Implementation

ContentApp({
  /// The directory to load pages from.
  ///
  /// This is relative to the root of the project.
  String directory = 'content',

  /// Whether to eagerly load all pages at startup. See the discussion on [ContentApp] for more information.
  this.eagerlyLoadAllPages = false,

  /// Whether to enable frontmatter parsing for pages.
  bool enableFrontmatter = true,

  /// The directory to load data files from.
  String dataDirectory = 'content/_data',

  /// An optional [TemplateEngine] to preprocess a page's content.
  TemplateEngine? templateEngine,

  /// A list of [PageParser]s to use for parsing the page content.
  ///
  /// Each parser may be responsible for a file type like markdown, html, etc.
  List<PageParser> parsers = const [],

  /// A list of [PageExtension]s to use for processing the parsed page nodes.
  ///
  /// Each extension may add or modify the nodes of the page.
  /// Extensions are applied in the order they are listed.
  List<PageExtension> extensions = const [],

  /// A list of [CustomComponent]s to use for rendering the page.
  List<CustomComponent> components = const [],

  /// A list of [PageLayout]s to use for building the page.
  ///
  /// When more than one layout is provided, the layout to use is determined by the 'layout' key in the page data.
  /// Therefore a page can choose its layout by setting 'layout: ___' in its frontmatter.
  /// When no key is set or matching, the first provided layout is used.
  List<PageLayout> layouts = const [],

  /// The [ContentTheme] to use for the pages.
  ContentTheme? theme,
  bool debugPrint = false,
}) : loaders = [FilesystemLoader(directory, debugPrint: debugPrint)],
     configResolver = PageConfig.all(
       enableFrontmatter: enableFrontmatter,
       dataLoaders: [FilesystemDataLoader(dataDirectory)],
       templateEngine: templateEngine,
       parsers: parsers,
       extensions: extensions,
       components: components,
       layouts: layouts,
       theme: theme,
     ),
     routerBuilder = _defaultRouterBuilder {
  _overrideGlobalOptions();
}