Home
Author Manual
Themes Guide
Development
Overview
fpm::Config
fpm::Document
fpm::Error
fpm::File
fpm::Font
fpm::Package
fpm::render
fpm::Result
fpm::StaticFile

fpm::Package

fpm::Package struct keeps track of a single fpm package.
#[derive(Debug, Clone)]
pub struct Package {
    pub name: String,
    pub translation_of: Box<Option<Package>>,
    pub translations: Vec<Package>,
    pub language: Option<String>,
    pub about: Option<String>,
    pub zip: Option<String>,
    pub translation_status_summary: Option<fpm::translation::TranslationStatusSummary>,
    pub canonical_url: Option<String>,
    pub dependencies: Vec<fpm::Dependency>,
    /// `auto_import` keeps track of the global auto imports in the package.
    pub auto_import: Vec<fpm::AutoImport>,
    pub fpm_path: Option<camino::Utf8PathBuf>,
    /// `ignored` keeps track of files that are to be ignored by `fpm build`, `fpm sync` etc.
    pub ignored_paths: Vec<String>,
    /// `fonts` keeps track of the fonts used by the package.
    ///
    /// Note that this too is kind of bad design, we will move fonts to `fpm::Package` struct soon.
    pub fonts: Vec<fpm::Font>,

    pub import_auto_imports_from_original: bool,
}

fpm::Package::generate_canonical_url()
FPM.ftd file can contain canonical-url key in fpm.package declaration. If this key is present this function returns the canonical-url, else it returns empty string.

pub fn fpm::Package::generate_canonical_url(&self, id: &str) -> String
id is the identifier of the document for which we want the canonical-url. id is appended to canonical-url found in FPM.ftd file.