mirror of
https://github.com/CoolnsX/my-website.git
synced 2025-12-20 07:15:19 +05:30
feat:UI and rss changes
This commit is contained in:
@@ -5,7 +5,7 @@ base_url = "https://coolans.dev"
|
|||||||
compile_sass = false
|
compile_sass = false
|
||||||
|
|
||||||
# When set to "true", the generated HTML files are minified.
|
# When set to "true", the generated HTML files are minified.
|
||||||
minify_html = false
|
minify_html = true
|
||||||
|
|
||||||
# When set to "true", a search index is built from the pages and section
|
# When set to "true", a search index is built from the pages and section
|
||||||
# content for `default_language`.
|
# content for `default_language`.
|
||||||
@@ -42,10 +42,10 @@ include_description = true
|
|||||||
# Whether to include the RFC3339 datetime of the page in the search index
|
# Whether to include the RFC3339 datetime of the page in the search index
|
||||||
include_date = true
|
include_date = true
|
||||||
# Whether to include the rendered content of the page/section in the index
|
# Whether to include the rendered content of the page/section in the index
|
||||||
include_content = true
|
include_content = false
|
||||||
# At which code point to truncate the content to. Useful if you have a lot of pages and the index would
|
# At which code point to truncate the content to. Useful if you have a lot of pages and the index would
|
||||||
# become too big to load on the site. Defaults to not being set.
|
# become too big to load on the site. Defaults to not being set.
|
||||||
truncate_content_length = 100
|
# truncate_content_length = 100
|
||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
# Put all your custom variables here
|
# Put all your custom variables here
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
+++
|
+++
|
||||||
title = "Hello World"
|
title = "Hello World"
|
||||||
date = 2025-06-15
|
date = 2025-05-16
|
||||||
extra.image = "assets/hello_world.webp"
|
extra.image = "assets/hello_world.webp"
|
||||||
description = "My First Blog."
|
description = "My First Blog."
|
||||||
+++
|
+++
|
||||||
|
|||||||
BIN
static/assets/blog-default.png
Normal file
BIN
static/assets/blog-default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
BIN
static/assets/favicon.ico
Normal file
BIN
static/assets/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -4,8 +4,9 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>{% block title %}{% endblock title %} - Coolans</title>
|
<title>{% block title %}{% endblock title %} - Coolans</title>
|
||||||
|
<link rel="icon" href="/assets/favicon.ico">
|
||||||
{% block rss %}
|
{% block rss %}
|
||||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml", trailing_slash=false) }}">
|
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path='rss.xml', trailing_slash=false) }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function openFullscreenTailwind(imgElement) {
|
function openFullscreenImage(imgElement) {
|
||||||
const overlay = document.createElement('div');
|
const overlay = document.createElement('div');
|
||||||
overlay.className = `
|
overlay.className = `
|
||||||
fixed inset-0 bg-black bg-opacity-90 backdrop-blur-sm flex items-center justify-center z-50
|
fixed inset-0 bg-black bg-opacity-90 backdrop-blur-sm flex items-center justify-center z-50
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
class="max-w-full max-h-100 object-cover border border-gray-600 rounded-2xl"
|
class="max-w-full max-h-100 object-cover border border-gray-600 rounded-2xl"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
onclick="openFullscreenTailwind(this)"
|
onclick="openFullscreenImage(this)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Blog Posts Container -->
|
<!-- Blog Posts Container -->
|
||||||
<div id="blog-posts" class="grid gap-8 md:grid-cols-2 lg:grid-cols-3">
|
<div id="blog-posts" class="grid gap-8 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3">
|
||||||
{% for page in section.pages %}
|
{% for page in section.pages %}
|
||||||
<a
|
<a
|
||||||
href="{{ page.permalink | safe }}"
|
href="{{ page.permalink | safe }}"
|
||||||
@@ -34,28 +34,33 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% set image_url = get_url(path=image) %}
|
{% set image_url = get_url(path=image) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
<img
|
{% set image_url = get_url(path='assets/blog-default.png') %}
|
||||||
src="{{ image_url | safe }}"
|
|
||||||
alt="{{ page.title }}"
|
|
||||||
class="w-full h-48 object-cover"
|
|
||||||
loading="lazy"
|
|
||||||
decoding="async"
|
|
||||||
/>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Card Image -->
|
||||||
|
<img
|
||||||
|
src="{{ image_url | safe }}"
|
||||||
|
alt="{{ page.title }}"
|
||||||
|
class="w-full h-50 object-cover"
|
||||||
|
loading="lazy"
|
||||||
|
decoding="async"
|
||||||
|
/>
|
||||||
|
|
||||||
<div class="p-6">
|
<div class="p-6">
|
||||||
<h2 class="text-xl font-semibold text-white mb-2">
|
<h2 class="text-2xl font-semibold text-white">
|
||||||
{{ page.title }}
|
{{ page.title }}
|
||||||
</h2>
|
</h2>
|
||||||
<p class="text-white text-sm">{{ page.date }}</p>
|
<p class="text-blue-400 text-sm mt-2">{{ page.date }}</p>
|
||||||
|
<p class="text-gray-300 text-sm mt-2">{{ page.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ElasticLunr and Script -->
|
<!-- Load ElasticLunr and Zola's search index -->
|
||||||
<script src="{{ get_url(path='elasticlunr.min.js') | safe }}"></script>
|
<script src="{{ get_url(path='elasticlunr.min.js') | safe }}"></script>
|
||||||
|
<script src="{{ get_url(path='search_index.en.js') | safe }}"></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const input = document.getElementById("search-input");
|
const input = document.getElementById("search-input");
|
||||||
@@ -64,29 +69,28 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
const index = elasticlunr(function () {
|
const index = elasticlunr(function () {
|
||||||
this.addField("title");
|
this.addField("title");
|
||||||
this.addField("description");
|
this.addField("description");
|
||||||
this.setRef("url");
|
this.setRef("id");
|
||||||
});
|
});
|
||||||
|
|
||||||
cards.forEach(card => {
|
const docs = window.searchIndex.documentStore.docs;
|
||||||
index.addDoc({
|
for (const id in docs) {
|
||||||
title: card.dataset.title,
|
if (docs.hasOwnProperty(id)) {
|
||||||
description: card.dataset.description,
|
index.addDoc(docs[id]);
|
||||||
url: card.dataset.url
|
}
|
||||||
});
|
}
|
||||||
});
|
|
||||||
|
|
||||||
input.addEventListener("input", function () {
|
input.addEventListener("input", function () {
|
||||||
const query = this.value.trim();
|
const query = this.value.trim().toLowerCase();
|
||||||
if (query.length < 1) {
|
if (!query) {
|
||||||
cards.forEach(c => c.style.display = "");
|
cards.forEach(c => c.style.display = "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const results = index.search(query, { expand: true });
|
const resultUrls = index.search(query, { expand: true }).map(r => r.ref);
|
||||||
const urls = results.map(r => r.ref);
|
|
||||||
|
|
||||||
cards.forEach(card => {
|
cards.forEach(card => {
|
||||||
card.style.display = urls.includes(card.dataset.url) ? "" : "none";
|
const url = card.dataset.url;
|
||||||
|
card.style.display = resultUrls.includes(url) ? "" : "none";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
48
templates/rss.xml
Normal file
48
templates/rss.xml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
|
||||||
|
<channel>
|
||||||
|
<title>{{ config.title }}
|
||||||
|
{%- if term %} - {{ term.name }}
|
||||||
|
{%- elif section.title %} - {{ section.title }}
|
||||||
|
{%- endif -%}
|
||||||
|
</title>
|
||||||
|
<link>
|
||||||
|
{%- if section -%}
|
||||||
|
{{ section.permalink | escape_xml | safe }}
|
||||||
|
{%- else -%}
|
||||||
|
{{ config.base_url | escape_xml | safe }}
|
||||||
|
{%- endif -%}
|
||||||
|
</link>
|
||||||
|
<description>{{ config.description }}</description>
|
||||||
|
<generator>Zola</generator>
|
||||||
|
<language>{{ lang }}</language>
|
||||||
|
<atom:link href="{{ feed_url | safe }}" rel="self" type="application/rss+xml"/>
|
||||||
|
<lastBuildDate>{{ last_updated | date(format="%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
|
||||||
|
{%- for page in pages %}
|
||||||
|
<item>
|
||||||
|
<title>{{ page.title }}</title>
|
||||||
|
<pubDate>{{ page.date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</pubDate>
|
||||||
|
<author>
|
||||||
|
{%- if page.authors -%}
|
||||||
|
{{ page.authors[0] }}
|
||||||
|
{%- elif config.author -%}
|
||||||
|
{{ config.author }}
|
||||||
|
{%- else -%}
|
||||||
|
Unknown
|
||||||
|
{%- endif -%}
|
||||||
|
</author>
|
||||||
|
<link>{{ page.permalink | escape_xml | safe }}</link>
|
||||||
|
{% if page.extra.image %}
|
||||||
|
{%- if page.extra.image is starting_with("http") -%}
|
||||||
|
{%- set image_url = page.extra.image -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set image_url = get_url(path=page.extra.image) -%}
|
||||||
|
{%- endif -%}
|
||||||
|
<media:thumbnail url="{{ image_url | safe }}" width="90" height="160"/>
|
||||||
|
{% endif -%}
|
||||||
|
<guid>{{ page.permalink | escape_xml | safe }}</guid>
|
||||||
|
<description xml:base="{{ page.permalink | escape_xml | safe }}">{% if page.summary %}{{ page.summary }}{% else %}{{ page.content }}{% endif %}</description>
|
||||||
|
</item>
|
||||||
|
{%- endfor %}
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
Reference in New Issue
Block a user