Skip to content

Commit 4bfd399

Browse files
committed
feat(post): add date button and clean up commented code
1 parent 08b6b95 commit 4bfd399

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

_layouts/post.html

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,38 @@ <h2 class="title post-title">
104104
<a href="/" class="button left-button">Home</a>
105105

106106
<!-- PDF Button -->
107-
<a href="#" id="downloadPdfButton" class="button pdf-button" data-file-path="{{ page.path }}">PDF</a>
107+
108+
<!-- <a href="#" id="downloadPdfButton" class="button pdf-button" data-file-path="{{ page.path }}">PDF</a> -->
108109

109110
<!-- Audio Button -->
110-
{% if page.audio %}
111+
112+
113+
114+
<!-- {% if page.audio %}
111115
<a href="#" id="playAudioButton" class="button audio-button" data-file-path="{{ page.path }}">Audio</a>
116+
{% endif %} -->
117+
118+
<!-- Date Button -->
119+
{% if page.path contains '20' %}
120+
{% assign date_parts = page.path | split: '/' %}
121+
{% assign date_segment = date_parts[1] %}
122+
123+
{% if date_segment contains '-' %}
124+
{% assign date_components = date_segment | split: '-' %}
125+
126+
{% if date_components.size >= 3 %}
127+
{% assign file_date = date_components[0] | append: '.' | append: date_components[1] | append: '.' | append:
128+
date_components[2] %}
129+
<a href="#" class="button">{{ file_date }}</a>
130+
{% else %}
131+
<a href="#" class="button">{{ 'now' | date: "%Y.%m.%d" }}</a>
112132
{% endif %}
113133

134+
{% else %}
135+
<a href="#" class="button">{{ 'now' | date: "%Y.%m.%d" }}</a>
136+
{% endif %}
137+
{% endif %}
138+
114139
<!-- Language Select Section -->
115140
{% assign current_lang = page.path | split: '-' | last | split: '.' | first %}
116141
{% assign file_parts = page.path | split: '/' | last | replace: ".md", "" | split: '-' %}
@@ -155,26 +180,6 @@ <h2 class="title post-title">
155180
<div class="button-container">
156181
<a href="/" class="button left-button">Back</a>
157182

158-
<!-- Date Button -->
159-
{% if page.path contains '20' %}
160-
{% assign date_parts = page.path | split: '/' %}
161-
{% assign date_segment = date_parts[1] %}
162-
163-
{% if date_segment contains '-' %}
164-
{% assign date_components = date_segment | split: '-' %}
165-
166-
{% if date_components.size >= 3 %}
167-
{% assign file_date = date_components[0] | append: '.' | append: date_components[1] | append: '.' | append:
168-
date_components[2] %}
169-
<a href="#" class="button">{{ file_date }}</a>
170-
{% else %}
171-
<a href="#" class="button">{{ 'now' | date: "%Y.%m.%d" }}</a>
172-
{% endif %}
173-
174-
{% else %}
175-
<a href="#" class="button">{{ 'now' | date: "%Y.%m.%d" }}</a>
176-
{% endif %}
177-
{% endif %}
178183

179184
<button id="themeTogglePost" class="icon-button" aria-label="Toggle Theme">
180185
{% include theme-icons.html %}

0 commit comments

Comments
 (0)