sounisi5011/metalsmith-netlify-published-date

View on GitHub
example/src/sub-page.pug

Summary

Maintainability
Test Coverage
---
title: Example Sub Page
canonicalPath: sub-page.html
pkgName: "@sounisi5011/metalsmith-netlify-published-date"
---

doctype html
html(lang="en")
    head
        meta(charset="utf-8")
        meta(name="viewport" content="width=device-width,initial-scale=1")
        meta(name="format-detection" content="telephone=no,email=no,address=no")
        title= `${pkgName} ${title}`
    body
        h1
            a(href="https://github.com/sounisi5011/metalsmith-netlify-published-date")
                = pkgName
            |
            |
            = title
        p
            | Page generation time:
            |
            time(datetime=dateBuilt.toISOString())
                = dateBuilt.getFullYear()
                | /
                = String(dateBuilt.getMonth() + 1).padStart(2, 0)
                | /
                = String(dateBuilt.getDate()).padStart(2, 0)
                |
                |
                = String(dateBuilt.getHours()).padStart(2, 0)
                | :
                = String(dateBuilt.getMinutes()).padStart(2, 0)
                | :
                = String(dateBuilt.getSeconds()).padStart(2, 0)
                |
                | UTC
                if 0 < dateBuilt.getTimezoneOffset()
                    | +
                else if dateBuilt.getTimezoneOffset() < 0
                    | -
                else
                    != '&plusmn;'
                = String(Math.trunc(Math.abs(dateBuilt.getTimezoneOffset()) / 60)).padStart(2, 0)
                | :
                = String(Math.abs(dateBuilt.getTimezoneOffset()) % 60).padStart(2, 0)

        if published instanceof Date
            p
                | Published at
                |
                time.published= published.toISOString()
        if modified instanceof Date
            p
                | Last updated at
                |
                time.modified= modified.toISOString()