Skip to content

Commit

Permalink
feat: add shortcodes to build Hextra home page (#90)
Browse files Browse the repository at this point in the history
* feat: add feature grid and card shortcodes

* feat: add markdown content to hextra home

* chore: add button for hextra home

* chore: add heading and subtitle

* chore: finish moving hextra home to shortcodes

* chore: regenerate css

* chore: improve hextra home layout shortcodes

* chore: update css

* chore: decrease button size
  • Loading branch information
imfing authored Sep 26, 2023
1 parent 01f7e3a commit 3c4ede9
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 132 deletions.
25 changes: 12 additions & 13 deletions assets/css/compiled/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ video {
.mb-4 {
margin-bottom: 1rem;
}
.mb-6 {
margin-bottom: 1.5rem;
}
.mb-8 {
margin-bottom: 2rem;
}
Expand Down Expand Up @@ -1002,17 +1005,9 @@ video {
--tw-bg-opacity: 1;
background-color: rgb(254 252 232 / var(--tw-bg-opacity));
}
.bg-gradient-to-b {
background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
}
.bg-gradient-to-r {
background-image: linear-gradient(to right, var(--tw-gradient-stops));
}
.from-gray-800 {
--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);
--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
.from-gray-900 {
--tw-gradient-from: #111827 var(--tw-gradient-from-position);
--tw-gradient-to: rgb(17 24 39 / 0) var(--tw-gradient-to-position);
Expand Down Expand Up @@ -1116,6 +1111,9 @@ video {
.pl-\[max\(env\(safe-area-inset-left\)\2c 1\.5rem\)\] {
padding-left: max(env(safe-area-inset-left),1.5rem);
}
.pr-2 {
padding-right: 0.5rem;
}
.pr-4 {
padding-right: 1rem;
}
Expand Down Expand Up @@ -1203,6 +1201,9 @@ video {
.leading-7 {
line-height: 1.75rem;
}
.leading-none {
line-height: 1;
}
.leading-tight {
line-height: 1.25;
}
Expand Down Expand Up @@ -1369,6 +1370,9 @@ video {
.duration-200 {
transition-duration: 200ms;
}
.ease-in {
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}
.ease-in-out {
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
Expand Down Expand Up @@ -3350,11 +3354,6 @@ body {
align-items: flex-start;
}

.sm\:px-4 {
padding-left: 1rem;
padding-right: 1rem;
}

.sm\:text-xl {
font-size: 1.25rem;
}
Expand Down
72 changes: 72 additions & 0 deletions exampleSite/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,75 @@
title: Hextra Theme
layout: hextra-home
---

{{< hextra/hero-badge >}}
<div class="w-2 h-2 rounded-full bg-primary-400"></div>
<span>Free, open source</span>
{{< icon name="arrow-circle-right" attributes="height=14" >}}
{{< /hextra/hero-badge >}}

<div class="mt-6 mb-6">
{{< hextra/hero-headline >}}
Build modern websites&nbsp;<br class="sm:block hidden" />with Markdown and Hugo
{{< /hextra/hero-headline >}}
</div>

<div class="mb-12">
{{< hextra/hero-subtitle >}}
Fast, batteries-included Hugo theme&nbsp;<br class="sm:block hidden" />for creating beautiful static websites
{{< /hextra/hero-subtitle >}}
</div>

<div class="mb-6">
{{< hextra/hero-button text="Get Started" link="docs" >}}
</div>

<div class="mt-6"></div>

{{< hextra/feature-grid >}}
{{< hextra/feature-card
title="Fast and Full-featured"
subtitle="Simple and easy to use, yet powerful and feature-rich."
class="aspect-auto md:aspect-[1.1/1] max-md:min-h-[340px]"
image="images/hextra-doc.webp"
imageClass="top-[40%] left-[24px] w-[180%] sm:w-[110%] dark:opacity-80"
style="background: radial-gradient(ellipse at 50% 80%,rgba(194,97,254,0.15),hsla(0,0%,100%,0));"
>}}
{{< hextra/feature-card
title="Markdown is All You Need"
subtitle="Compose with just Markdown. Enrich with Shortcode components."
class="aspect-auto md:aspect-[1.1/1] max-lg:min-h-[340px]"
image="images/hextra-markdown.webp"
imageClass="top-[40%] left-[36px] w-[180%] sm:w-[110%] dark:opacity-80"
style="background: radial-gradient(ellipse at 50% 80%,rgba(142,53,74,0.15),hsla(0,0%,100%,0));"
>}}
{{< hextra/feature-card
title="Full Text Search"
subtitle="Built-in full text search with FlexSearch, no extra setup required."
class="aspect-auto md:aspect-[1.1/1] max-md:min-h-[340px]"
image="images/hextra-search.webp"
imageClass="top-[40%] left-[36px] w-[110%] sm:w-[110%] dark:opacity-80"
style="background: radial-gradient(ellipse at 50% 80%,rgba(221,210,59,0.15),hsla(0,0%,100%,0));"
>}}
{{< hextra/feature-card
title="Lightweight as a Feather"
subtitle="No dependency or Node.js is needed to use Hextra. Powered by Hugo, one of *the fastest* static site generators, building your site in just seconds with a single binary."
>}}
{{< hextra/feature-card
title="Reponsive with Dark Mode Included"
subtitle="Looks great on different screen sizes. Built-in dark mode support, with auto-switching based on user's system preference."
>}}
{{< hextra/feature-card
title="Build and Host for Free"
subtitle="Build with GitHub Actions, and host for free on GitHub Pages. Alternatively it can be hosted on any static hosting service."
>}}
{{< hextra/feature-card
title="Multi-Language Made Easy"
subtitle="Create multi-language pages by just adding locales suffix to the Markdown file. Adding i18n support to your site is intuitive."
>}}
{{< hextra/feature-card
title="And Much More..."
icon="sparkles"
subtitle="Syntax highlighting / Table of contents / SEO / RSS / LaTeX / Mermaid / Customizable / and more..."
>}}
{{< /hextra/feature-grid >}}
9 changes: 5 additions & 4 deletions exampleSite/hugo_stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"path",
"pre",
"script",
"section",
"span",
"strong",
"style",
Expand Down Expand Up @@ -94,7 +93,6 @@
"bg-black/[.05]",
"bg-blue-100",
"bg-clip-text",
"bg-gradient-to-b",
"bg-gradient-to-r",
"bg-gray-100",
"bg-neutral-50",
Expand Down Expand Up @@ -228,6 +226,7 @@
"data-[state=selected]:text-primary-600",
"decoration-from-font",
"duration-200",
"ease-in",
"ease-in-out",
"filename",
"first:mt-0",
Expand All @@ -246,7 +245,6 @@
"footnote-backref",
"footnote-ref",
"footnotes",
"from-gray-800",
"from-gray-900",
"gap-1",
"gap-2",
Expand Down Expand Up @@ -274,6 +272,7 @@
"hamburger-menu",
"hextra-card",
"hextra-cards",
"hextra-feature-card",
"hextra-filetree",
"hextra-filetree-folder",
"hextra-footer",
Expand Down Expand Up @@ -320,6 +319,7 @@
"leading-5",
"leading-6",
"leading-7",
"leading-none",
"leading-tight",
"left-[24px]",
"left-[36px]",
Expand Down Expand Up @@ -367,6 +367,7 @@
"mb-16",
"mb-2",
"mb-4",
"mb-6",
"mb-8",
"md:aspect-[1.1/1]",
"md:h-[calc(100vh-var(--navbar-height)-var(--menu-height))]",
Expand Down Expand Up @@ -439,6 +440,7 @@
"pl-[max(env(safe-area-inset-left),1.5rem)]",
"placeholder:text-gray-500",
"pointer-events-none",
"pr-2",
"pr-4",
"pr-[calc(env(safe-area-inset-right)-1.5rem)]",
"pr-[max(env(safe-area-inset-left),1.5rem)]",
Expand Down Expand Up @@ -513,7 +515,6 @@
"sm:flex",
"sm:grid-cols-2",
"sm:items-start",
"sm:px-4",
"sm:text-xl",
"sm:w-[110%]",
"sr-only",
Expand Down
116 changes: 4 additions & 112 deletions layouts/hextra-home.html
Original file line number Diff line number Diff line change
@@ -1,118 +1,10 @@
{{ define "main" }}
<div class='mx-auto flex {{ partial "utils/page-width" . }}'>
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true) }}
<div class="w-full break-words flex flex-col min-h-[calc(100vh-var(--navbar-height))] min-w-0 justify-start pb-8 pr-[calc(env(safe-area-inset-right)-1.5rem)]">
<section class="flex max-w-[90rem] flex-col items-start gap-2 px-6 sm:px-4 pt-8 md:pt-12">
<a
href="https://github.com/imfing/hextra"
target="_blank"
rel="noreferrer"
class="inline-flex items-center rounded-full gap-2 px-3 py-1 text-xs text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-neutral-800 dark:border-neutral-800 border hover:border-gray-400 dark:hover:text-gray-50 dark:hover:border-gray-600"
>
<div class="w-2 h-2 rounded-full bg-primary-400"></div>
<span>Free, open source</span>
{{- partial "utils/icon" (dict "name" "arrow-circle-right" "attributes" "height=14") -}}
</a>
<h1
class="text-4xl font-bold leading-tight tracking-tighter md:text-5xl mt-6 bg-clip-text text-transparent bg-gradient-to-r from-gray-900 to-gray-600 dark:from-gray-100 dark:to-gray-400"
>
Build modern websites&nbsp;<br class="sm:block hidden" />
with Markdown and Hugo
</h1>
<p class="mt-4 text-xl text-gray-600 dark:text-gray-400 sm:text-xl">
Fast, batteries-included Hugo theme <br class="sm:block hidden" />
for creating beautiful static websites.
</p>
<div class="mt-8">
{{- $docsURL := "docs" | relURL -}}
<a
href="{{ $docsURL }}"
class="font-medium cursor-pointer px-6 py-3 text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-4 focus:ring-primary-300 rounded-full text-center mr-2 mb-2 dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
>
Get Started
</a>
</div>
</section>
<section class="flex max-w-[90rem] flex-col items-start gap-2 px-6 sm:px-4 pt-8 pb-8">
<h2 class="mt-12 text-2xl font-bold bg-clip-text text-transparent bg-gradient-to-b from-gray-800 to-gray-600 dark:from-gray-100 dark:to-gray-400">What's in Hextra?</h2>
<div class="mt-6 grid sm:grid-cols-2 lg:grid-cols-3 grid-cols-1 gap-4 w-full">
{{ template "hextra-feature-card" (dict
"title" "Fast and Full-featured"
"subtitle" "Simple and easy to use, yet powerful and feature-rich. "
"class" "aspect-auto md:aspect-[1.1/1] max-md:min-h-[340px]"
"image" "images/hextra-doc.webp"
"imageClass" "top-[40%] left-[24px] w-[180%] sm:w-[110%] dark:opacity-80"
"style" "background: radial-gradient(ellipse at 50% 80%,rgba(194,97,254,0.15),hsla(0,0%,100%,0));"
)
}}
{{ template "hextra-feature-card" (dict
"title" "Markdown is All You Need"
"subtitle" "Compose with just Markdown. Enrich with Shortcode components."
"class" "aspect-auto md:aspect-[1.1/1] max-lg:min-h-[340px]"
"image" "images/hextra-markdown.webp"
"imageClass" "top-[40%] left-[36px] w-[180%] sm:w-[110%] dark:opacity-80"
"style" "background: radial-gradient(ellipse at 50% 80%,rgba(142,53,74,0.15),hsla(0,0%,100%,0));"
)
}}
{{ template "hextra-feature-card" (dict
"title" "Full Text Search"
"subtitle" "Built-in full text search with FlexSearch, no extra setup required."
"class" "aspect-auto md:aspect-[1.1/1] max-md:min-h-[340px]"
"image" "images/hextra-search.webp"
"imageClass" "top-[40%] left-[36px] w-[110%] sm:w-[110%] dark:opacity-80"
"style" "background: radial-gradient(ellipse at 50% 80%,rgba(221,210,59,0.15),hsla(0,0%,100%,0));"
)
}}
{{ template "hextra-feature-card" (dict
"title" "Lightweight as a Feather"
"subtitle" "No dependency or Node.js is needed to use Hextra. Powered by Hugo, one of *the fastest* static site generators, building your site in just seconds with a single binary."
)
}}
{{ template "hextra-feature-card" (dict
"title" "Reponsive with Dark Mode Included"
"subtitle" "Looks great on different screen sizes. Built-in dark mode support, with auto-switching based on user's system preference."
)
}}
{{ template "hextra-feature-card" (dict
"title" "Build and Host for Free"
"subtitle" "Build with GitHub Actions, and host for free on GitHub Pages. Alternatively it can be hosted on any static hosting service."
)
}}
{{ template "hextra-feature-card" (dict
"title" "Multi-Language Made Easy"
"subtitle" "Create multi-language pages by just adding locales suffix to the Markdown file. Adding i18n support to your site is intuitive."
)
}}
{{ template "hextra-feature-card" (dict
"title" "And Much More..."
"subtitle" "Syntax highlighting / Table of contents / SEO / RSS / LaTeX / Mermaid / Customizable / and more..."
)
}}
</div>
</section>
<div class="w-full break-words min-h-[calc(100vh-var(--navbar-height))] min-w-0 pb-8 pt-8 md:pt-12 pl-[max(env(safe-area-inset-left),1.5rem)] pr-[max(env(safe-area-inset-left),1.5rem)]">
<div class="flex flex-col items-start">
{{ .Content }}
</div>
</div>
</div>
{{ end }}

{{- define "hextra-feature-card" -}}
{{- $title := .title -}}
{{- $subtitle := .subtitle -}}
{{- $class := .class -}}
{{- $image := .image -}}
{{- $imageClass := .imageClass -}}
{{- $style := .style -}}


<div
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
class="{{ $class }} relative overflow-hidden rounded-3xl border border-gray-200 hover:border-gray-300 dark:border-neutral-800 dark:hover:border-neutral-700 before:pointer-events-none before:absolute before:inset-0 before:bg-glass-gradient"
>
<div class="relative w-full p-6">
<h3 class="text-2xl font-medium leading-6 mb-2">{{ $title }}</h3>
<p class="text-gray-500 text-sm leading-6">{{ $subtitle | markdownify }}</p>
</div>
{{- with $image -}}
<img src="{{ . }}" class="absolute max-w-none {{ $imageClass }}" alt="{{ $title }}" />
{{- end -}}
</div>
{{- end -}}
28 changes: 28 additions & 0 deletions layouts/shortcodes/hextra/feature-card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- $title := .Get "title" -}}
{{- $subtitle := .Get "subtitle" -}}
{{- $class := .Get "class" -}}
{{- $image := .Get "image" -}}
{{- $imageClass := .Get "imageClass" -}}
{{- $style := .Get "style" -}}
{{- $icon := .Get "icon" -}}


<div
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
class="{{ $class }} hextra-feature-card relative overflow-hidden rounded-3xl border border-gray-200 hover:border-gray-300 dark:border-neutral-800 dark:hover:border-neutral-700 before:pointer-events-none before:absolute before:inset-0 before:bg-glass-gradient"
>
<div class="relative w-full p-6">
<h3 class="text-2xl font-medium leading-6 mb-2 flex items-center">
{{ with $icon -}}
<span class="pr-2">
{{- partial "utils/icon.html" (dict "name" . "attributes" "height=1.5rem") -}}
</span>
{{ end -}}
<span>{{ $title }}</span>
</h3>
<p class="text-gray-500 dark:text-gray-400 text-sm leading-6">{{ $subtitle | markdownify }}</p>
</div>
{{- with $image -}}
<img src="{{ . }}" class="absolute max-w-none {{ $imageClass }}" alt="{{ $title }}" />
{{- end -}}
</div>
9 changes: 9 additions & 0 deletions layouts/shortcodes/hextra/feature-grid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- $style := .Get "style" -}}


<div
class="grid sm:grid-cols-2 lg:grid-cols-3 grid-cols-1 gap-4 w-full"
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
>
{{ .Inner }}
</div>
15 changes: 15 additions & 0 deletions layouts/shortcodes/hextra/hero-badge.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- $link := .Get "link" -}}
{{- $external := hasPrefix $link "http" -}}
{{- $href := cond (hasPrefix $link "/") ($link | relURL) $link -}}
{{- $class := .Get "class" }}
{{- $style := .Get "style" -}}


<a
href="{{ $href }}"
class="{{ $class }} inline-flex items-center rounded-full gap-2 px-3 py-1 text-xs text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-neutral-800 dark:border-neutral-800 border hover:border-gray-400 dark:hover:text-gray-50 dark:hover:border-gray-600 transition-all ease-in duration-200"
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
{{ if $external }}target="_blank" rel="noreferrer"{{ end -}}
>
{{ .Inner | markdownify }}
</a>
Loading

0 comments on commit 3c4ede9

Please sign in to comment.