@@ -2,17 +2,24 @@ import ConcurrencyExtras
22import Dependencies
33import HTML
44import Hummingbird
5+ import PublicAssets
56import Vue
67
78public protocol Page : Sendable , HTMLDocument , ResponseGenerator {
89 var title : String { get }
10+ var desc : String { get }
911 var lang : String { get }
1012
1113 var chunkSize : Int { get }
1214 var headers : HTTPFields { get }
1315}
1416
1517extension Page {
18+ public var title : String { " Erik Bautista Santibanez " }
19+ public var desc : String {
20+ """
21+ """
22+ }
1623 public var lang : String { " en " }
1724 public var chunkSize : Int { 1024 }
1825 public var headers : HTTPFields { [ . contentType: " text/html; charset=utf-8 " ] }
@@ -21,6 +28,8 @@ extension Page {
2128 _ document: consuming Self ,
2229 into output: inout Output
2330 ) {
31+ @Dependency ( \. publicAssets) var assets
32+
2433 withDependencies {
2534 $0. ssg = . groupedStyles
2635 } operation: {
@@ -30,6 +39,29 @@ extension Page {
3039 meta ( . charset( . utf8) )
3140 tag ( " title " ) { document. title }
3241 meta ( . name( " viewport " ) , . content( " width=device-width, initial-scale=1.0 " ) )
42+ meta ( . name( " robots " ) , . content( " index, follow " ) )
43+
44+ // opengraph meta
45+ meta ( . property( " og:title " ) , . content( document. title) )
46+ meta ( . property( " og:description " ) , . content( document. desc) )
47+ // TODO: move to env-var
48+ meta ( . property( " og:url " ) , . content( " https://erikb.dev " ) )
49+ meta ( . property( " og:image " ) , . content( assets. assets. og. cardPng. url. assetString) )
50+ meta ( . property( " og:site_name " ) , . content( document. title) )
51+ meta ( . property( " og:type " ) , . content( " website " ) )
52+
53+ // X (formely Twitter) meta
54+ meta ( . property( " twitter:card " ) , . content( assets. assets. og. cardPng. url. assetString) )
55+ meta ( . property( " twitter:title " ) , . content( document. title) )
56+ meta ( . property( " twitter:creator " ) , . content( " @erikbautista_ " ) )
57+ meta ( . property( " twitter:description " ) , . content( document. desc) )
58+
59+ link ( . rel( " icon " ) , . custom( name: " type " , value: " image/png " ) , . custom( name: " sizes " , value: " 16x16 " ) , . href( assets. assets. favicon16x16Png. url. assetString) )
60+ link ( . rel( " icon " ) , . custom( name: " type " , value: " image/png " ) , . custom( name: " sizes " , value: " 32x32 " ) , . href( assets. assets. favicon32x32Png. url. assetString) )
61+ link ( . rel( " icon " ) , . custom( name: " type " , value: " image/png " ) , . custom( name: " sizes " , value: " 96x96 " ) , . href( assets. assets. favicon96x96Png. url. assetString) )
62+ link ( . rel( " icon " ) , . custom( name: " type " , value: " image/png " ) , . custom( name: " sizes " , value: " 128x128 " ) , . href( assets. assets. favicon128x128Png. url. assetString) )
63+ link ( . rel( " icon " ) , . custom( name: " type " , value: " image/png " ) , . custom( name: " sizes " , value: " 196x196 " ) , . href( assets. assets. favicon196x196Png. url. assetString) )
64+
3365 style {
3466 " /*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */*,::after,::before{box-sizing:border-box}html{font-family:system-ui,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji';line-height:1.15;-webkit-text-size-adjust:100%;tab-size:4}body{margin:0}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-color:currentcolor}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item} "
3567 }
@@ -112,9 +144,9 @@ extension Page {
112144 body: {
113145 document. body
114146 . inlineStyle ( " font-optical-sizing " , " auto " )
115- . inlineStyle ( " font-size " , " 0.7em " )
116- . inlineStyle ( " font-size " , " 0.8em " , media: . minWidth( 390 ) )
117- . inlineStyle ( " font-size " , " 0.9em " , media: . minWidth( 480 ) )
147+ . inlineStyle ( " font-size " , " 0.78em " )
148+ . inlineStyle ( " font-size " , " 0.86em " , media: . minWidth( 390 ) )
149+ . inlineStyle ( " font-size " , " 0.94em " , media: . minWidth( 480 ) )
118150 . attribute ( " lang " , value: document. lang)
119151
120152 script ( . type( . module) , . defer) {
0 commit comments