---
import { cn } from '@/lib/utils'
const { href, external, class: className, underline, ...rest } = Astro.props
---
<a
href={href}
target={external ? '_blank' : '_self'}
class={cn(
'inline-block transition-colors duration-300 ease-in-out',
underline &&
'underline decoration-muted-foreground underline-offset-[3px] hover:decoration-foreground',
className,
)}
{...rest}
>
<slot />
</a>
We were able to, in a single helper function:
- Concatenate whatever the user passed via the
class
prop to our base styles - Conditionally add an underline if the
underline
prop is true
Awesome!
Welcoming some UX features
Within the blog itself (in terms of layout, appearance, and navigation), several features are essential for ensuring a great user experience:
-
Theme selectors are designed to be self-explanatory. One is added to the top right of the header, which is
sticky
instead ofabsolute
, so it doesn’t break the document flow (and thus there’s no need to addmt-20
to the top of every page). -
The table of contents for a post should not be reduced to a
<details closed>
at the beginning of a blog post on desktop. Navigating through the contents would otherwise require scrolling to the top of the page. A stickyTableOfContents
component has been implemented, always positioned at the unused left side margin of the blog post. A tiny client-side script utilizingIntersectionObserver
highlights the headings currently in view within the TOC as the page is scrolled. This also handles nested headings, where the parent heading of a visible child remains highlighted even if off-screen (see the 404 page). On mobile, a collapsible<details>
element is still used for the table of contents, as a side navigation for small screens is impractical. -
Every page, except the homepage, features a
<Breadcrumb>
component that shows the user’s current location in the site hierarchy. Breadcrumbs are excellent for both discoverability (SEO and crawling) and user experience, as they help users understand how “deep” they are within the site. -
Each tag has its own page, which lists all of the posts under that tag.
-
is fully supported with KaTeX.
To solve the cubic equation (where the real numbers satisfy ) one can use Cardano’s formula:
For any and , the Cauchy–Bunyakovsky–Schwarz inequality can be written as follows:
Finally, the determinant of a Vandermonde matrix can be calculated using the following expression:
—Three famous mathematical formulas (Mozilla Docs)
Something important
- No need for CMS.
- Ctrl + K shortcut.
Something more important
- Foo
- Bar
- FizzBuzz