simple-blog-engine
Version:
Современный легковесный генератор статического блога с поддержкой Markdown
104 lines (82 loc) • 3.08 kB
Plain Text
# Instant View Template for Simple Blog (Version 2.1)
# Apply to static post pages generated by the static site generator
?path: /posts/.+
# Site info - specify your Telegram channel if you have one
#channel: https://t.me/your_channel_name
# Site name must match the name visible on the website (required for IV 2.1)
site_name: "Simple Blog"
# Title - extract from the h1 in the post-header
title: //article[contains(@class, "post")]/header[contains(@class, "post-header")]/h1
# Cover image - if a featured image exists, use it as the cover
@if_exists: //article[contains(@class, "post")]//img[1]
cover: //article[contains(@class, "post")]//img[1]
@end
# Author - extract from the post-author span
author: //span[contains(@class, "post-author")]/text()
# Publication date - extract from the time element
published_date: //div[contains(@class, "post-meta")]/time
# Description for link preview - use the summary if available
@if_exists: //*[contains(@class, "post-summary")]
description: //*[contains(@class, "post-summary")]
@end
# Content extraction - main article content
body: //div[contains(@class, "post-content")]
# RTL support for languages like Arabic, Hebrew, Persian (if needed)
# @if: //html[@dir="rtl" or @lang="ar" or @lang="he" or @lang="fa"]
# @set_attr(dir): rtl
# @end
# Handle code blocks specially to ensure proper formatting
@replace_tag(<pre><code>): <pre>
@replace_tag(<pre><code class): <pre class
# Format blockquotes correctly, preserve line breaks
@match: //blockquote
@wrap(<blockquote>): $@
@match: //blockquote//cite
@wrap(<cite>): $@
# Process images to ensure they display properly, preserve captions if any
@match: //img
@wrap(<figure>): $@
@match: //img[@alt and not(parent::figure)]
@wrap(<figure>): $@
@append(<figcaption>): @alt
# Fix relative image paths
@replace: //img[@src and (not(starts-with(@src, "http://")) and not(starts-with(@src, "https://")))]
@attribute: src
@replace_value: $@
@prepend_value: https://your_domain.com/
# Process headings for proper semantics
@match: //h2
@wrap: <h2>
@match: //h3
@wrap: <h3>
@match: //h4
@wrap: <h4>
# Make sure links are properly handled
@replace: //a[@href and not(starts-with(@href, "http")) and not(starts-with(@href, "https")) and not(starts-with(@href, "#"))]
@attribute: href
@replace_value: $@
@prepend_value: https://your_domain.com/
# Handle lists properly (including nested lists)
@match: //ul
@wrap(<ul>): $@
@match: //ol
@wrap(<ol>): $@
# Add related articles block for tag links
@match: //div[contains(@class, "post-tags")]/a
@wrap_inner(<related>): $@
# Remove unnecessary elements
@remove: //div[contains(@class, "social-share")]
@remove: //div[contains(@class, "table-of-contents")]
@remove: //script
# Handle tables if they exist
@if_exists: //table
@match: //table
@wrap(<table>): $@
@end
# Mark any complex/unsupported content to prevent broken IVs
@unsupported: //iframe
@unsupported: //form
@unsupported: //canvas
# For any dynamic/interactive content that can't be represented in IV
@match: //div[contains(@class, "interactive-element")]
@unsupported: $@