Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site: SEO bugfixes, mobile styles #180

Merged
merged 1 commit into from
Jan 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import tools.elide.data.CompressionMode
import java.io.ByteArrayOutputStream
import java.io.OutputStream
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets
import java.security.MessageDigest
import java.time.Duration
import java.util.Locale
Expand Down Expand Up @@ -823,15 +822,24 @@ abstract class SitePageController protected constructor(val page: SitePage) : Pa
portions.add(mapOf(
"@type" to "ListItem",
"position" to 1,
"item" to mapOf(
"name" to page.parent!!.title,
),
))
portions.add(mapOf(
"@type" to "ListItem",
"position" to 2,
"item" to mapOf(
"name" to page.title,
),
))
} else {
portions.add(mapOf(
"@type" to "ListItem",
"position" to 1,
"item" to mapOf(
"name" to page.title,
),
))
}

Expand Down Expand Up @@ -919,6 +927,10 @@ abstract class SitePageController protected constructor(val page: SitePage) : Pa

// page title
title { +renderTitle() }
meta {
name = "viewport"
content = "width=device-width, initial-scale=1"
}

// UI and analytics scripts
script {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object ElideSite {
override val prelabel = "αlpha"

/** Main heading to use for the navigation bar. */
override val heading = "$name Framework"
override val heading = name
}

/** Default site info. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package elide.site.pages
import elide.site.I18nPage
import elide.site.abstract.SitePage
import java.net.URI
import elide.site.pages.defaults.Home as Defaults
import elide.site.pages.defaults.GettingStarted as Defaults
import java.util.*

/** Describes the Elide Getting Started page. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import elide.site.I18nPage
import elide.site.abstract.SitePage
import java.net.URI
import java.util.*
import elide.site.pages.defaults.Runtime as Defaults
import elide.site.pages.defaults.Library as Defaults

/** Describes the Elide library intro top-level page. */
actual object Library : SitePage(
Expand Down
7 changes: 2 additions & 5 deletions site/docs/node/src/main/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ import org.w3c.fetch.Request
import react.ReactElement
import web.url.URL

const val enableStreaming = true
const val chunkCss = true

// Setup Emotion cache.
private fun setupCache(context: dynamic): EmotionCache {
val statejson = JSON.stringify(context, emptyArray(), 0)
val cspNonce = context.getNonce()
return createCache(jso {
key = "es"
Expand Down Expand Up @@ -89,13 +86,13 @@ var modEmotionServer: EmotionServer? = null
this,
request,
emotionCache,
), stream = enableStreaming).execute {
), stream = true).execute {
try {
if (it.hasContent) {
response += it.content
}

if (enableStreaming && chunkCss && it.fin) {
if (it.fin) {
// in the final chunk, splice in CSS from Emotion.
val emotionChunks = emotionServer.extractCriticalToChunks(response)
val emotionCss = emotionServer.constructStyleTagsFromChunks(emotionChunks)
Expand Down
35 changes: 33 additions & 2 deletions site/docs/ui/src/main/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pre, .mono {
}

.elide-site-page__header, .elide-site-page__header h2 {
font-size: 2.5rem !important;
font-size: 2.5rem;
}

/**
Expand Down Expand Up @@ -240,7 +240,6 @@ main#root {

.elide-site-page.narrative {
padding: 3rem;
height: 100%;
}

.elide-site-page.narrative header {
Expand Down Expand Up @@ -300,3 +299,35 @@ main#root {
left: 20px;
bottom: 20px;
}


/**
* ======= Styles: Mobile =======
*/
@media screen and (max-device-width: 960px) {
.elide-site-container {
max-width: 100%;
overflow: hidden;
grid-template-columns: 0 auto !important;
}

.elide-site-page.narrative {
padding: 1.5rem;
}
.elide-site-page__header h2 {
font-size: 1.75rem;
font-weight: 400;
}
.elide-sidebar {
display: none;
}
}

/**
* ======= Styles: Desktop =======
*/
@media screen and (min-device-width: 960px) {
.MuiSpeedDial-root {
display: none;
}
}
2 changes: 1 addition & 1 deletion site/docs/ui/src/main/assets/base.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 53 additions & 3 deletions site/docs/ui/src/main/assets/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
}

.elide-page__home-nav {
margin-left: 10rem;
display: flex;
flex-direction: row;
justify-content: flex-end;
Expand Down Expand Up @@ -127,8 +126,8 @@ span.elide-brand-text.masthead-text {
font-size: 2rem;
}

.elide-logotext {
font-size: 2rem !important;
.elide-page__home .elide-logotext {
font-size: 2rem;
}

.elide-page__home.elide-theme__light {
Expand Down Expand Up @@ -218,3 +217,54 @@ span.masthead-text__highlight {
content: '·';
margin: 0 10px;
}

/**
* ======= Styles: Mobile =======
*/
@media screen and (max-device-width: 960px) {
.elide-page__home .elide-site-page {
overflow-y: scroll;
}

/* content columns must stack vertically */
.elide-page__home-content {
flex-direction: column !important;
min-height: auto;
height: auto;
align-items: center;
}

/* reduce padding around masthead text */
.elide-page__home-masthead-text.masthead-text__title {
font-size: 3rem;
}
.elide-page__home .masthead-text__subtitle, .elide-page__home .masthead-text__subtitle span {
font-size: 1.3rem;
}

/* masthead text can take full-width */
.elide-page__home .masthead-text__title, .elide-page__home .masthead-text-subtitle, .elide-page__home-masthead-cta {
max-width: 95%;
}

/* columns should display as blocks */
.elide-page__home .elide-page__home-column {
display: block;
}

/* "right"-side column should also take full width */
.elide-page__home-column.elide-page__home-column-right {
display: none;
}

/* make footer text bigger */
.elide-page__home .elide-footer {
background: transparent;
user-select: none;
}

/* hide nav links */
.elide-page__home-nav button, .elide-page__home-nav a {
display: none;
}
}
Loading