Simplify Blog

Last updated


Two-column personal blog SPA rendered entirely by JS (PDRenderKit 1.0.1): sticky left profile/nav, right pane swapping list, article, about and contact views.

Overview


ItemValue
Created2023-07-12
CategoryBlog Examples
HTML filesindex.html
Sourcetarget/20230712

Preview


Simplify Blog screenshot
Open the example in a new tab

Page Sections


SectionDescription
Left profile panel (#section-left)Name 'PARDN CHIU', intro text, HOME/ABOUT/CONTACT menu (ul[index] marks the active item), social icon links, copyright.
Post list (.list)10 article cards (image, title, excerpt, date, category) and a static pager (‹ 1 2 3 ›).
Article view (.article)Hero figure, h1, meta line and rich text body (h3-h6, lists, links, blockquote), plus an 'ALL POSTS' back button.
About viewSelf-introduction with skill list, project link (JOBALL) and contact list, ending with a 'Get in touch' button.
Contact view (.contact)Heading, two paragraphs, Name and Email inputs and a message textarea with a 'Get in touch' button (no submit handler).

Interactions


  • js/index.js: _CLICK_HOME / _CLICK_ABOUT / _CLICK_CONTACT replace the whole body via body.__child() and reset scrollTop, acting as client-side view switching.
  • Clicking a list card calls _CLICK_ARTICLE to show the article view; 'ALL POSTS' returns to the list.
  • Social icons use PDRenderKit ._open(url) to open external links.

Dependencies



Styling


ItemValue
SCSS entrysass/index.scss
Output CSScss/index.css
Partials_section-left.scss, _section-right.scss, _list.scss, _article.scss

index.scss holds the reset, safe-area vars and the body flex layout (column on mobile, row from 800px); _section-left styles the sticky profile sidebar, _section-right the content pane and buttons and imports _list (post cards) and _article (article typography). Colors use var(--color-dark-*), var(--width-max) and var(--bgcolor).
  1. cd target/20230712
  2. npx sass sass/index.scss css/index.css --no-source-map || exit 1

Techniques


  • Whole DOM built in JS with PDRenderKit string-tag syntax: (section + "#section-left")._([...children]), array ._$() mapping, ._click(), "fa-..."._fa icons.
  • Tag names assembled from single-letter globals (_0_, __0, _0...) passed into an IIFE, e.g. [_s, _e, _c, _t, _i, _o, _n].$str(_empty).
  • position: sticky sidebar from 800px; breakpoints 480/640/800/1280px; aspect-ratio card images (16/10, 2/1, 3/1).
  • env(safe-area-inset-*) CSS vars, hidden scrollbars, lazy image placeholder for img[data-src] via a 1px GIF and gradient.

External Assets




中文