
struct TagPageGeneratorSource: PostListPageGeneratorSource {

    let language: ContentLanguage

    let content: Content

    let results: PageGenerationResults

    let tag: Tag

    var postsPerPage: Int {
        content.settings.posts.postsPerPage
    }

    var pageTitle: String? {
        linkPreview.title ?? tag.localized(in: language).name
    }

    private var linkPreview: LinkPreview {
        tag.localized(in: language).linkPreview
    }

    var linkTitle: String? {
        linkPreview.title
    }

    var linkDescription: String? {
        linkPreview.description
    }

    var linkImage: FileResource? {
        linkPreview.image
    }

    func pageUrlPrefix(for language: ContentLanguage) -> String {
        tag.absoluteUrl(in: language)
    }
}
