Skip to content

Commit

Permalink
sidebar copyright date working now
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Jul 11, 2024
1 parent a4a5995 commit 8e79e0a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ xxx add either:
xxx move <style> to bottom to avoid leaks: fgrep '<style>' $(finddot html)
xxx autogen rss
xxx mobile size tables
xxx .newest only defined 2nd request / when localStorage is read from prior 1st request as of now

Your posts or directories of posts, should ideally natural sort in time order, examples:
2022-11-03-a-birthday.md
Expand Down
4 changes: 3 additions & 1 deletion js/blogtini.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ function markdown_to_post(markdown, url = location.pathname) {
const title = json.title?.trim() ?? ''
const tags = (json.tags ?? []).map((e) => e.trim().replace(/ /g, '-').toLowerCase())
const categories = (json.categories ?? []).map((e) => e.trim().replace(/ /g, '-').toLowerCase())
const date = json.date || json.created_at || '' // xxx any more possibilities should do?
const date = json.date || json.created_at || '' // xxx any more possibilities should do? // xxx try to parse date from start of path/url!

if (!date) {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -545,6 +545,8 @@ async function parse_posts(markdowns) {
function storage_loop() {
showdown.setFlavor('github') // xxx?

state.newest = STORAGE.newest

for (const post of STORAGE.docs) {
for (const tag of post.tags) {
state.tags[tag] = state.tags[tag] || []
Expand Down
2 changes: 1 addition & 1 deletion theme/future-imperfect/bt-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ customElements.define('bt-body', class extends LitElement {
${cfg.footer?.social ? socnet_icon() : ''}
</ul>` : ''}
<p class="copyright">
${cfg.copyright ?? html`\u00A9 ${/* xxxxxxxxxxxxxxxxxxxxxxxxxxxx */globalThis.STORAGE?.newest?.slice(0, 4) ?? ''} ${cfg.author ?? cfg.title}`}
${cfg.copyright ?? html`\u00A9 ${state.newest?.slice(0, 4) ?? ''} ${cfg.author ?? cfg.title}`}
<br>
${cfg.attribution ? unsafeHTML(cfg.attribution) : ''}
</p>
Expand Down

0 comments on commit 8e79e0a

Please sign in to comment.