Allow custom thumbnail paths in metadata
This commit is contained in:
@ -265,7 +265,7 @@ struct PageContentGenerator {
|
||||
|
||||
content[.title] = linkedPage.title(for: language)
|
||||
|
||||
let fullThumbnailPath = linkedPage.thumbnailFilePath(for: language)
|
||||
let fullThumbnailPath = linkedPage.thumbnailFilePath(for: language).destination
|
||||
let relativeImageUrl = page.relativePathToOtherSiteElement(file: fullThumbnailPath)
|
||||
let metadata = linkedPage.localized(for: language)
|
||||
|
||||
|
@ -21,7 +21,7 @@ struct PageHeadGenerator {
|
||||
// Note: Generate separate destination link for the image,
|
||||
// since we don't want a single large image for thumbnails.
|
||||
// Warning: Link preview source path must be relative to root
|
||||
let linkPreviewImageName = image.insert("-link", beforeLast: ".")
|
||||
let linkPreviewImageName = "thumbnail-link.\(image.lastComponentAfter("."))"
|
||||
let sourceImagePath = page.pathRelativeToRootForContainedInputFile(image)
|
||||
let destinationImagePath = page.pathRelativeToRootForContainedInputFile(linkPreviewImageName)
|
||||
files.requireImage(
|
||||
|
@ -14,8 +14,8 @@ struct ThumbnailListGenerator {
|
||||
}
|
||||
|
||||
private func itemContent(_ item: Element, parent: Element, language: String, style: ThumbnailStyle) -> String {
|
||||
let fullThumbnailPath = item.thumbnailFilePath(for: language)
|
||||
let relativeImageUrl = parent.relativePathToFileWithPath(fullThumbnailPath)
|
||||
let (thumbnailSourcePath, thumbnailDestPath) = item.thumbnailFilePath(for: language)
|
||||
let relativeImageUrl = parent.relativePathToFileWithPath(thumbnailDestPath)
|
||||
let metadata = item.localized(for: language)
|
||||
var content = [ThumbnailKey : String]()
|
||||
|
||||
@ -37,16 +37,16 @@ struct ThumbnailListGenerator {
|
||||
}
|
||||
|
||||
files.requireImage(
|
||||
source: fullThumbnailPath,
|
||||
destination: fullThumbnailPath,
|
||||
source: thumbnailSourcePath,
|
||||
destination: thumbnailDestPath,
|
||||
requiredBy: item.path,
|
||||
width: style.width,
|
||||
desiredHeight: style.height)
|
||||
|
||||
// Create image version for high-resolution screens
|
||||
files.requireImage(
|
||||
source: fullThumbnailPath,
|
||||
destination: fullThumbnailPath.insert("@2x", beforeLast: "."),
|
||||
source: thumbnailSourcePath,
|
||||
destination: thumbnailDestPath.insert("@2x", beforeLast: "."),
|
||||
requiredBy: item.path,
|
||||
width: style.width * 2,
|
||||
desiredHeight: style.height * 2)
|
||||
|
Reference in New Issue
Block a user