# Blogs & Websites from Markdown & JS ## Content first, Decentralizable, Archivable ### [Tracey Jaquith](https://twitter.com/tracey_pooh) #### [DwebCamp 2022](https://dwebcamp.org) [tracey.archive.org](https://tracey.archive.org) --- # The Idea [tracey.archive.org](https://tracey.archive.org) --- # A Site --- # A Post --- # View Source --- # Huh? The page reads & parses itself ```js const [frontmatter, markdown] = markdown_parse( document.getElementsByTagName('body')[0].innerHTML ) ``` [JS](https://blogtini.com/js/blogtini.js) --- # [Files Layout](https://github.com/traceypooh/ipfstini) --- --- ## Publish full blog & web pages - content 100% markdown - theme & markdown-to-markup using JavaScript --- ## Publish full blog & web pages - free github.com, gitlab.com - using a `sitemap.xml` or RSS feed

โ€ข pages can be hosted anywhere

โ€ข including DWeb

โ€ข like "pointers" to your posts/pages

--- ## How ๐Ÿ•ท๏ธ
JS "crawls" your site
parses markdown "front matter"
- date
- title
- tags
- categories
`showdown` to convert to HTML
re-paints page
`localStorage` to save analyzed site, auto-updates daily (can force re-cache)
`lunr` for browser searching your posts/pages
--- ## Why ๐Ÿค” - each post or page is a markdown file

โ€ข markdown is primary, archive-friendly, format/theme agnostic

โ€ข site formatting is _secondary_

--- ## Why ๐Ÿค” - all posts/pages can live in free `git` repo - github.com, gitlab.com, DWeb, self-hosted, etc.

โ€ข no build step, no backend needed
- just a static file server

โ€ข theme can be changed anytime (1 line change)

โ€ข [_good_ google SEO](https://www.google.com/search?q=site%3Ablogtini.com+and)

โ€ข google & more crawlers doing JS rendering

--- ## Why ๐Ÿค” - "View Source" is your original content -- no formatting, no clutter

โ€ข You control your content

โ€ข posting to facebook, twitter, strava sucks

โ€ข where is your content?

โ€ข _what_ do you do with your GDPR?

โ€ข your data should last forever

โ€ข "roach proof" content-only format

--- ## Life is better client-side ๐Ÿ˜Š - No build step - No back-end - Just html + JS static files --- ### Life is better client-side ๐Ÿ˜Š ```js // parse frontmatter & (optional) `config.yml` import yml from 'https://esm.archive.org/js-yaml' // markdown-to-html import showdown from 'https://esm.archive.org/showdown' // code highlighting import hljs from 'https://esm.archive.org/highlightjs' // client-side search - like `solr` import lunr from 'https://esm.archive.org/lunr' // date/time hacking import dayjs from 'https://esm.archive.org/dayjs' // comments import './staticman.js' // sort hashmap by key import { krsort } from 'https://av.archive.org/js/util/strings.js' ``` --- ## Static Sites - _comments_ possible using `staticman`, etc. - `staticman` -- comments go into your site repository - _website search_ using `lunr` JS - can use `git` "hooks" to run small script: - keeps `sitemap.xml` and RSS feed up-to-date - minor comments management --- ## Try it! ๐Ÿค“ Simple as: - create new file - index.html - contents:
โ€โ€โ€
title: my neat post
date: 2022-08-27
tags:
  โ€ blogging
  โ€ markdown
comment: <script src="https://blogtini.com/js/blogtini.js" type="module" charset="utf-8"></script>
โ€โ€โ€
Having fun *blogging* and hoping to write _more_ this year.
--- # Preview ๐Ÿ‘€ - use any basic http file server, eg: ```sh python3 -m http.server ``` - OR open `index.html` in browser - [mac]: double click from `finder` folder; `open index.html` in `terminal` - copy url to `safari` (if not already) - dev tools, disable CORS restrictions & reload --- --- # Examples https://blogtini.com/ Site with all posts in same github repository --- # Examples https://traceypooh.github.io/dwebtini/ Site with posts served from multiple storage sites - github - IPFS - web3 - archive.org _(click post links and notice browser url chnages)_ --- # Examples https://ipfs.io/ipfs/QmWhoVkYm2SNoPEAK5ZmKFNtqVAietNsdzZrZYWK9KaXw9/ Site with all posts on IPFS --- # Publish โœ๐Ÿฝ - make https://github.com account - create and `git clone` a new repository - add your `index.html` file - add `.nojekyll` (empty) file - `git push` - [turn on GitHub Pages](https://docs.github.com/en/pages/quickstart) - https://[YOUR-GITHUB-USERNAME].github.io/[REPOSITORY-NAME]/ --- # Extending out - millions of sites linked together - save a list of friends & families for a merged activity "feed" - only needs to determine latest few posts from each site per sitemap/RSS - JS "crawl" them, parse their markdown, merge into decentralized feed --- # Future ๐Ÿ”ฎ - Aggregate all _your data/posts_ (twitter, facebook, etc.) to markdown posts on _your own_ site - Friends & Family aggregate sitemap/feed - Friends & Family client-side aggregate lunr search - comments go to correct specific site/place/person/entity --- # Future ๐Ÿ”ฎ Archive a site of many sites

Just one combo `sitemap.xml` away !

--- # Future ๐Ÿ”ฎ - https://www.w3.org/TR/activitypub - SocialWG _(Christine is here...)_ - publish new activity - notify followers in their chosen way --- # GDPR ๐Ÿ‡ช๐Ÿ‡บ - General Data Protection Regulation (EU)

โ€ข primary aim is to enhance individuals' control & rights over their personal data

"must be able to transfer personal data from one electronic processing system to and into another, without being prevented from doing so"

--- # Longevity ๐Ÿง›

โ€ข If `WordPress` goes away, billions of people _disappear forever_

โ€ข Average web page is gone in *three months*

โ€ข Make your (digital) life a _Vampire_

โ€ข Make it _Live Forever_

--- # Longevity ๐Ÿช„ ``` โ€œTell me, what is it you plan to do with your one wild and precious life?โ€ ``` [Mary Oliver - "The Summer Day"](https://wordsfortheyear.com/2015/06/21/the-summer-day-by-mary-oliver/) --- ## ๐Ÿ™๐Ÿฝ Thank You! ๐Ÿ™๐Ÿฝ [tracey.archive.org](https://tracey.archive.org) --- # Postscript ๐Ÿ“ธ --- --- --- --- --- --- --- # STORJ