Skip to content

Commit

Permalink
Merge pull request #9 from bujijam/test
Browse files Browse the repository at this point in the history
a
  • Loading branch information
bujijam authored Sep 3, 2024
2 parents bd8ede3 + 965b094 commit 61b9efc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
6 changes: 5 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
theme: minima
theme: minima
collections:
my_posts:
output: true
permalink: /:collection/:path/
Empty file added _my_posts/test1.md
Empty file.
Empty file added _my_posts/test2.md
Empty file.
35 changes: 33 additions & 2 deletions blog.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
<!DOCTYPE html>
---
title: My Blog
---

<article>
{% for post in site.my_posts %}
<summary>
<h2>{{ post.title }}</h2>
<p>{{ post.excerpt }}</p>
<small>{{ post.date | date_to_string }}</small>
<img src="{{ post.index-img }}" alt="Blog Image">
</summary>
<div class="content" style="display: none;">
{{ post.content }}
</div>
<button
onclick="this.previousElementSibling.style.display='none'; this.nextElementSibling.style.display='block';">Read
More</button>
{% endfor %}
</article>

<script>
document.querySelectorAll('summary').forEach(function (summary) {
summary.onclick = function () {
this.style.display = 'none';
this.nextElementSibling.style.display = 'block';
return false; // Prevent the default action of the <summary> tag
};
});
</script>

<!-- <!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -73,4 +104,4 @@ <h1 class="blog-title">这是标题</h1>
</body>
<script src="./blog/blog.js"></script>
</html>
</html> -->

0 comments on commit 61b9efc

Please sign in to comment.