Advanced Components
Advanced components with advanced docs
Web Content Render
Quote
The Quote
component is a simple component that displays a random quote.
import { Quote } from '../../../theme/components/advanced'
<Quote />
Renders:
Loading...
Config:
export const integ: IntegrationUserConfig = {
// Add a random quote to the footer (default on homepage footer)
quote: {
// https://github.com/lukePeavey/quotable
server: 'https://api.quotable.io/quotes/random?maxLength=60', // [!code highlight:2]
target: `(data) => data[0].content || 'Error'`
}
}
Quotable ↗ is a open-source API that provides random English quotes.
For Chinese quotes, you can use Hitokoto ↗.
export const integ: IntegrationUserConfig = {
quote: {
// https://developer.hitokoto.cn/sentence/#%E8%AF%B7%E6%B1%82%E5%9C%B0%E5%9D%80
server: 'https://v1.hitokoto.cn/?c=i', // [!code highlight:2]
target: `(data) => data.hitokoto || 'Error'`
}
}
GitHub Card
The GithubCard
component is a simple component that displays a GitHub user card.
import { GithubCard } from '../../../theme/components/advanced'
<GithubCard repo='cworld1/astro-theme-pure' />
Render:
cworld1 / astro-theme-pure
Waiting for api.github.com...
???
???
???
Link Preview
Preview any link inserted in the content.
import { LinkPreview } from '../../../theme/components/advanced'
<LinkPreview href='https://www.cloudflare.com/' />
// `zoomable` option will control mediumzoom tag
// <LinkPreview href='https://www.cloudflare.com/' zoomable={false} />
<LinkPreview href='https://www.cloudflare.com/' hideMedia />
Render:
Data Transformer
QRCode
import { QRCode } from '../../../theme/components/advanced'
// <QRCode /> // default to render current page link
<QRCode
content='https://github.com/cworld1/astro-theme-pure'
class='inline-flex max-w-44 p-3 bg-muted rounded-lg border' />
Render:
Medium Zoom
Try click the following image.
See Other Integrations#medium-zoom.
Individual Server Integration
Comment System
See Comment#Usage.