pub struct I18nPlugin { /* private fields */ }Expand description
I18n plugin that injects hreflang links and generates per-locale sitemaps.
Implements two complementary phases:
transform_html— per-file hreflang<link>injection that runs inside the fused transform pass, ensuring Taxonomy/Pagination output is covered alongside template-engine pages.after_compile— per-locale sitemap generation and the root-level locale-redirect index page (whole-site artefacts that cannot be produced from a per-file hook).
Implementations§
Source§impl I18nPlugin
impl I18nPlugin
Sourcepub fn new(config: I18nConfig) -> Self
pub fn new(config: I18nConfig) -> Self
Creates a new I18nPlugin with the given i18n configuration.
§Examples
use ssg::i18n::{I18nConfig, I18nPlugin};
use ssg::plugin::Plugin;
let cfg = I18nConfig::default();
let p = I18nPlugin::new(cfg);
assert_eq!(p.name(), "i18n");Trait Implementations§
Source§impl Debug for I18nPlugin
impl Debug for I18nPlugin
Source§impl Plugin for I18nPlugin
impl Plugin for I18nPlugin
Source§fn transform_html(
&self,
html: &str,
path: &Path,
ctx: &PluginContext,
) -> Result<String, SsgError>
fn transform_html( &self, html: &str, path: &Path, ctx: &PluginContext, ) -> Result<String, SsgError>
Per-file hreflang injection.
Runs inside the fused transform pass so it covers HTML produced by
any plugin (Taxonomy, Pagination, template engine). Idempotent — a
page that already carries hreflang <link> tags is returned
unchanged. Pages without parallel translations are left untouched
so that missing translations never yield broken hreflang entries.
Source§fn after_compile(&self, ctx: &PluginContext) -> Result<(), SsgError>
fn after_compile(&self, ctx: &PluginContext) -> Result<(), SsgError>
Called after site compilation completes. Read more
Source§fn has_transform(&self) -> bool
fn has_transform(&self) -> bool
Returns
true if this plugin implements transform_html.
Override to true to opt in to the fused transform pass.Source§fn before_compile(&self, _ctx: &PluginContext) -> Result<(), SsgError>
fn before_compile(&self, _ctx: &PluginContext) -> Result<(), SsgError>
Called before site compilation begins. Read more
Source§fn needs_all_files(&self) -> bool
fn needs_all_files(&self) -> bool
Returns
true if this plugin must always observe the full
cache.html_files() list — even during --incremental
rebuilds that only invalidated a handful of pages. Read moreAuto Trait Implementations§
impl !Freeze for I18nPlugin
impl RefUnwindSafe for I18nPlugin
impl Send for I18nPlugin
impl Sync for I18nPlugin
impl Unpin for I18nPlugin
impl UnsafeUnpin for I18nPlugin
impl UnwindSafe for I18nPlugin
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more