willfaught/paige 是一个托管在 GitHub 上的开源项目,主要使用 HTML 编写,采用 European Union Public License 1.2 许可证,目前获得 320 个 Star、79 次 Fork。
仓库全名
willfaught/paige
README 摘要
Paige Powerful, pliable pixel perfection. An advanced Hugo theme. Try it out. Paige is designed to put your content front and center, avoiding the typical clutter. The look is seamless and smooth, scalable and readable, portable and efficient. The layout is minimal and responsive, using verticality and white space to delineate and highlight each part of the page. The implementation is flexible and extensible. It’s a…
Powerful, pliable pixel perfection.
An advanced Hugo theme.
Try it out.
Paige is designed to put your content front and center,
avoiding the typical clutter.
The look is seamless and smooth,
scalable and readable,
portable and efficient.
The layout is minimal and responsive,
using verticality and white space to delineate and highlight each part of the page.
The implementation is flexible and extensible.
It’s a versatile canvas that serves most needs.
Hugo must be the extended version, and at least version 0.141.0.
Create a site:
$ hugo new site yoursite
Configure your module:
$ sh
$ cd yoursite
$ hugo mod init github.com/youraccount/yoursite
$ cat >>hugo.toml <<EOF
[markup.highlight]
noclasses = false
style = "github"
EOF
Configure the Paige module:
$ sh
$ cd yoursite
$ hugo mod get github.com/willfaught/paige@latest
$ cat >>hugo.toml <<EOF
[[module.imports]]
path = "github.com/willfaught/paige"
EOF
Create a post:
$ cd yoursite
$ hugo new yourpost.md
Build and run the site for development:
$ cd yoursite
$ hugo server --buildDrafts
Build the site for production:
$ cd yoursite
$ hugo --environment production --minify
Update the Paige module:
$ cd yoursite
$ hugo mod get github.com/willfaught/paige@latest
Paige uses Semantic Versioning.
The current major version is 0.
From time to time, breaking changes are made.
When you update Paige, you must test your site.
See CHANGES.md for details.
By default, everything is enabled, which is likely not what you want.
See the minimal look section for ideas of what to disable.
By default, the page body spans its entire container, which spans most of the window.
See the narrow look and narrow-and-wide look sections
for ideas of how to customize the presentation.
The breadcrumb, collection, section, and page links are sufficient to browse any site,
so you can safely disable the menu.
However, for sites with only a couple handfuls of sections and pages at the root level,
and without nested sections,
the menu alone can be sufficient for all navigation.
See the menu navigation only section for how to do that.
To add analytics, put the code in yoursite/layouts/_partials/paige/site-last.html.
See the include section.
To add comments, put the code in yoursite/layouts/_partials/paige/page-body-last-page.html.
See the include section.
Configure
Parameters
There is a single parameter object with sensible defaults that can be overridden in site or page parameters:
[paige]
enable_math = false # Enables math typesetting for this page
exclude_feeds = false # Excludes this page from feeds
exclude_search = false # Excludes this page from search
style = "" # CSS included in a stylesheet for this page
[paige.alert]
message = "" # Markdown displayed before the page body for this page
type = "primary" # Bootstrap alert class for this page
[paige.feeds]
disable_link = false # Disables using the link parameter for the page URL
page_link = "⏎" # Link to the page with this text if the link parameter is set and disable_link is false
[paige.feeds.atom]
authors = []
# Example:
# [[paige.feeds.atom.authors]]
# email = "[email protected]"
# name = "John Doe"
# url = "https://github.com/account/project"
icon = "" # Example: "/icon.webp"
logo = "" # Example: "/logo.webp"
[paige.feeds.rss]
managing_editor = "" # Example: "[email protected] (John Doe)"
web_master = "" # Example: "[email protected] (John Doe)"
[paige.pages]
# Content
disable_authors = false
disable_collections = false
disable_date = false
disable_description = false
disable_edit = false
disable_history = false
disable_keywords = false
disable_next = false
disable_pages = false
disable_prev = false
disable_reading_time = false
disable_sections = false
disable_series = false
disable_title = false
disable_toc = false
disable_word_count = false
# Presentation
full_width = false # Whether the page body fills the page width
maximize_heading_levels = false # Whether to shift heading levels higher as much as possible
maximum_heading_level = 6 # The maximum heading level to shift heading levels to
minimize_heading_levels = false # Whether to shift heading levels lower as much as possible
minimum_heading_level = 2 # The minimum heading level to shift heading levels to
normalize_heading_levels = false # Whether to shift heading levels higher to fill heading level gaps
# Schema
base_schema = {} # JSON-LD schema that all page schemas override
# Example:
# [paige.pages.base_schema]
# isAccessibleForFree = true
# isFamilyFriendly = true
# [paige.pages.base_schema.publisher]
# "@type" = "Organization"
# name = "John Doe"
# url = "https://example.com"
disable_auto_schema = false # Disables the automatic JSON-LD schema generation
microdata = {} # Microdata non-property attributes (all except itemprop) for the web page
# Example:
# [paige.pages.microdata]
# itemid = "foo"
# itemref = "bar"
# itemscope = ""
# itemtype = "https://schema.org/Chapter
schemas = [] # JSON-LD schemas
# Example:
# [[paige.pages.schemas]]
# "@context" = "https://schema.org"
# "@type" = "Book"
# name = "My Book"
# url = "https://example.com"
[paige.site]
# Behavior
date_format = ":date_long" # Hugo date format
external_link_new_tab = false # Open external links in new tabs
# Content
disable_copyright = false
disable_credit = false
disable_description = false
disable_license = false
disable_title = false
# Navigation
disable_breadcrumbs = false
disable_menu = false
# Presentation
color = "#0d6efd" # Bootstrap primary color and theme color for Safari and Windows
color_scheme = "auto" # Must be "auto", "dark", or "light"
keyword_style = "text" # Must be "text" or "pills"
menu_style = "links" # Must be "links", "pills", "tabs", or "underline"
# Repository
edit_url = "" # Example: "https://github.com/account/project/edit/master/content/%s"
history_url = "" # Example: "https://github.com/account/project/commits/master/content/%s"
# Schema
base_schema = {} # JSON-LD schema that all site schemas override
# Example:
# [paige.site.base_schema]
# isAccessibleForFree = true
# isFamilyFriendly = true
# [paige.site.base_schema.publisher]
# "@type" = "Organization"
# name = "John Doe"
# url = "https://example.com"
schemas = [] # JSON-LD schemas
# Example:
# [[paige.site.schemas]]
# "@context" = "https://schema.org"
# "@type" = "Organization"
# name = "Acme"
# url = "https://example.com"
# Values
credit = '<a class="link-secondary text-decoration-none" href="https://github.com/willfaught/paige">Paige Theme</a>'
description = "" # Site description. Appears above the menu and below the site title. Used in feeds.
license = "" # Example: "CC BY 4.0 License"
[paige.subpages]
disable_authors = false
disable_date = false
disable_description = false
disable_keywords = false
disable_reading_time = false
disable_series = false
disable_summary = false
disable_title = false
disable_word_count = false
The parameter object is accessed in site parameters as [params.paige], and in page parameters as [paige].
Parameters for pages:
id = "" # Unique URI used in feeds. Defaults to a tag URN with the relative permalink.
link = "" # URL for an anchor around the title. Example: "https://youtu.be/dQw4w9WgXcQ".
Parameters for terms of the authors taxonomy:
[paige.author]
default = false # Whether to attribute pages without explicit authors to this author
email = "" # Used in feeds. Example: "[email protected]".
name = "" # Used in feeds. Example: "John Doe".
url = "" # Used in Atom feeds. Example: "https://example.com".
Parameters for menus:
[paige]
disabled = false
divider_above = false
divider_below = false
header_above = "" # Example: "My Header"
header_below = "" # Example: "My Other Header"
The assigned values shown are the default values unless otherwise specified.
Menu
The menu can be configured using the main menu.
The active menu item has a page path that is a prefix of the path of the current page.
The author, description, and keywords meta tags are generated from the page parameters.
The keywords are the page parameters keywords, categories, and tags.
A JSON-LD script is generated from the page parameters,
which can be disabled with paige.pages.disable_auto_schema.
Arbitrary schemas can be specified for the site with paige.site.schemas
or for pages with paige.pages.schemas, at the site or page level.
A base schema can be specified for site schemas with paige.site.base_schema,
and for page schemas with paige.pages.base_schema.
HTML microdata is generated from the page parameters
if the non-property attributes are specified in paige.pages.microdata.
Layouts
Cloud
The paige-cloud layout provides a link cloud for subpages.
Example configuration in yoursite/content/tags/_index.md:
layout = "paige-cloud"
Search
The paige-search layout provides a search page.
Example configuration in yoursite/hugo.toml:
[outputs]
home = ["html", "paige-search"]
Example configuration in yoursite/content/search.md:
layout = "paige-search"
title = "Search"
Shortcodes
Code
The paige-code shortcode provides highlighted code.
Parameters:
lang
Optional. Position 0. String. Chroma language code. Default is "plaintext".
Optional. Boolean. Whether to reverse the HTML escaping in the body. Useful for when the request shortcode is used in the body.
Body: Required. String. The code.
Email
The paige-email shortcode hides e-mail addresses from robots.
Parameters:
address
Required. Position 0. String. The e-mail address.
Body: Required. String. Markdown. The content.
Figure
The paige-figure shortcode provides a figure.
Parameters:
caption
Optional. Position 0. String. Markdown. Descriptive text below the content.
float
Optional. String. Float to one side of its container. Must be "start" or "end".
height
Optional. String. CSS value. Total height.
horizontal
Optional. String. Horizontal alignment. Must be "start", "center", or "end". Default is "center".
maxwidth
Optional. String. CSS value. Maximum total width.
number
Optional. Integer or string. Figure number. Displayed with the caption.
numbered
Optional. Boolean. Number the figure automatically. Displayed with the caption.
vertical
Optional. String. Vertical alignment. Must be "start", "center", or "end". Default is "center".
width
Optional. String. CSS value. Total width.
Body: Required. String. Markdown. The content.
Gallery
The paige-gallery shortcode provides an arrangement of images.
Parameters:
align
Optional. String. Cross axis alignment. Must be "baseline", "center", "end", "start", or "stretch".
breakpoints
Optional. Boolean. Whether to generate copies of the image sized to each Bootstrap breakpoint. Must not use with densities. Only applies to raster images.
class
Optional. String. Image class. Merged with implementation classes.
densities
Optional. String. Float numbers suffixed with an "x", delimited by spaces. The pixel densities of the image to generate. There must be at least two. The largest density matches the original image. Examples are "1x 2x", "1x 1.5x 2x 2.5x 3x", and "0.5x 1.33x 6x 10x". Must not use with breakpoints. Only applies to raster images.
fetchpriority
Optional. String. Must be "high" or "low".
height
Optional. String. CSS value. Image height.
images
Optional. Position 0. String. Page, site, or remote images glob. Default is all image page resources.
justify
Optional. String. Main axis space distribution. Must be "around", "between", "center", "end", "evenly", or "start".
linked
Optional. Boolean or string. Wraps the image in an anchor. If it is a string, it is Hugo image processing methods and options, mixed together, for the linked image. If no method is specified, resize is used. If no image dimensions are specified, the originals are used. If it is default, the default options are used. If it is a Boolean, it is unprocessed. Must be a Boolean for vector images.
loading
Optional. String. Must be "eager" (default) or "lazy".
maxheight
Optional. String. CSS value. Maximum image height.
maxwidth
Optional. String. CSS value. Maximum image width.
process
Optional. String. Hugo image processing methods and options, mixed together, for the displayed image. If no method is specified, resize is used. If no image dimensions are specified, the originals are used. If it is "default", the default options are used. Only applies to raster images.
style
Optional. String. CSS. Image style. Merged with implementation styles.
type
Optional. String. Type of layout. Must be "grid" or "rows" (default).
width
Optional. String. CSS value. Image width.
Body: Optional. String. HTML. The images.
Icon
The paige-icon shortcode provides a web font icon.
Parameters:
class
Required. Position 0. String. Container class. Example: "bi bi-github".
title
Optional. String. The screen reader description and anchor title. Example: "GitHub".
url
Optional. String. URL. Example: "https://github.com/account/project". E-mails in URLs with a mailto: scheme are protected from web crawlers.
Body: None.
Image
The paige-image shortcode provides an image.
Parameters:
alt
Optional. String. Plain text. Image alt.
breakpoints
Optional. Boolean. Whether to generate copies of the image sized to each Bootstrap breakpoint. Must not use with densities, sizes, or srcset. Only applies to raster images.
class
Optional. String. Class attribute value.
densities
Optional. String. Float numbers suffixed with an "x", delimited by spaces. The pixel densities of the image to generate. There must be at least two. The largest density matches the original image. Examples are "1x 2x", "1x 1.5x 2x 2.5x 3x", and "0.5x 1.33x 6x 10x". Must not use with breakpoints, sizes, or srcset. Only applies to raster images.
fetchpriority
Optional. String. Must be "high" or "low".
height
Optional. String. CSS value. Image height.
link
Optional. String. URL. Image link. Must not use with linked.
linked
Optional. Boolean or string. Wraps the image in an anchor. If it is a string, it is Hugo image processing methods and options, mixed together, for the linked image. If no method is specified, resize is used. If no image dimensions are specified, the originals are used. If it is "default", the default options are used. If it is a Boolean, it is unprocessed. Must be a Boolean for vector images. Must not use with link.
loading
Optional. String. Must be "eager" (default) or "lazy".
maxheight
Optional. String. CSS value. Image maximum height.
maxwidth
Optional. String. CSS value. Image maximum width.
process
Optional. String. Hugo image processing methods and options, mixed together, for the displayed image. If no method is specified, resize is used. If no image dimensions are specified, the originals are used. If it is "default", the default options are used. Only applies to raster images.
sizes
Optional. String. Image sizes. Must not use with breakpoints or densities.
src
Required. Position 0. String. URL. Image source.
srcset
Optional. String. Image srcset. Must not use with breakpoints or densities.
style
Optional. String. CSS. Image style. Merged with implementation styles.
title
Optional. String. Plain text. Image title.
width
Optional. String. CSS value. Image width.
Body: None.
Quote
The paige-quote shortcode provides a quotation.
Parameters:
cite
Optional. String. Markdown. Citation.
Body: Required. String. Markdown. The quotation.
Request
The paige-request shortcode provides the content for a URL.
Parameters:
method
Optional. String. HTTP method. Default is "get".
url
Required. String. URL.
Body: None.
Tabs
The paige-tabs shortcode provides tab buttons and tab panes.
It must contain one paige-tabs-buttons shortcode, and then one paige-tabs-panes shortcode.
Parameters: None.
Body: Required. String. HTML. The tab buttons and tab panes.
The paige-tabs-buttons shortcode provides tab buttons.
It must contain one or more paige-tabs-button shortcodes.
Each paige-tabs-button shortcode corresponds to the paige-tabs-pane shortcode in the same position.
Parameters: None.
Body: Required. String. HTML. The tab buttons.
The paige-tabs-button shortcode provides a tab button.
Parameters: None.
Body: Required. String. Markdown. The tab button content.
The paige-tabs-panes shortcode provides tab panes.
It must contain one or more paige-tabs-pane shortcodes.
Each paige-tabs-pane shortcode corresponds to the paige-tabs-button shortcode in the same position.
Parameters: None.
Body: Required. String. HTML. The tab panes.
The paige-tabs-pane shortcode provides a tab pane.
Parameters: None.
Body: Required. String. Markdown. The tab pane content.
Vimeo
The paige-vimeo shortcode provides a Vimeo video.
Parameters:
autopause
Optional. Boolean. Enable playing more than one Vimeo video on the same page. Default is true.
autoplay
Optional. Boolean. Autoplay the video. Default is false.
background
Optional. Boolean. Autoplay the video. Hide the controls. Loop the video. Mute the video. Default is false.
byline
Optional. Boolean. Show the author. Default is configured per video.
color
Optional. String. Hex code. Control color. Default is "00adef".
controls
Optional. Boolean. Show the controls. Default is true.
Optional. Integer. Elapsed seconds. Stop the video here.
fullscreen
Optional. Boolean. Enable full screen. Default is true.
height
Optional. String. CSS value. Video height.
list
Optional. String. Playlist ID.
loop
Optional. Boolean. Loop the video.
maxheight
Optional. String. CSS value. Video maximum height.
maxwidth
Optional. String. CSS value. Video maximum width.
mute
Optional. Boolean. Mute the video.
start
Optional. Integer. Elapsed seconds. Start the video here.
video
Optional. Position 0. String. Video ID.
width
Optional. String. CSS value. Video width.
Body: None.
Customize
Include
Files can be included in many places in HTML.
If this file exists in your site
It is included at
layouts/_partials/paige/html-body-first.html
The beginning of the HTML body
layouts/_partials/paige/html-body-last.html
The ending of the HTML body
layouts/_partials/paige/html-head-first.html
The beginning of the HTML head
layouts/_partials/paige/html-head-last.html
The ending of the HTML head
layouts/_partials/paige/page-body-first.html
The beginning of the page body
layouts/_partials/paige/page-body-last.html
The ending of the page body
layouts/_partials/paige/page-first.html
The beginning of the page
layouts/_partials/paige/page-footer-first.html
The beginning of the page footer
layouts/_partials/paige/page-footer-last.html
The ending of the page footer
layouts/_partials/paige/page-header-first.html
The beginning of the page header
layouts/_partials/paige/page-header-last.html
The ending of the page header
layouts/_partials/paige/page-last.html
The ending of the page
layouts/_partials/paige/site-body-first.html
The beginning of the site body
layouts/_partials/paige/site-body-last.html
The ending of the site body
layouts/_partials/paige/site-first.html
The beginning of the site
layouts/_partials/paige/site-footer-first.html
The beginning of the site footer
layouts/_partials/paige/site-footer-last.html
The ending of the site footer
layouts/_partials/paige/site-header-first.html
The beginning of the site header
layouts/_partials/paige/site-header-last.html
The ending of the site header
layouts/_partials/paige/site-last.html
The ending of the site
There are kind variants of include files that are included only when the file kind matches the page kind.
If this file exists in your site
It is included when
layouts/_partials/paige/[PLACE]-home.html
The page kind is “home”
layouts/_partials/paige/[PLACE]-page.html
The page kind is “page”
layouts/_partials/paige/[PLACE]-section.html
The page kind is “section”
layouts/_partials/paige/[PLACE]-taxonomy.html
The page kind is “taxonomy”
layouts/_partials/paige/[PLACE]-term.html
The page kind is “term”
Above, the place placeholder must be “body-first”, “body-last”, “head-first”, etc.
Kind variants are included right after their counterpart non-kind variant.
The argument for the templates is the page.
Override
Most code is in partial templates that the layout templates use.
Code can be added, changed, or removed easily by overriding the corresponding layout or partial template.
For example, layouts/_default/list.html and layouts/_default/single.html include layouts/partial/paige/page.html.
layouts/partial/paige/page.html includes layouts/partial/paige/page-header.html.
To change the page title for those layout templates, change layouts/partial/paige/page-header.html.
To change the page title for layouts/_default/single.html only,
replace the inclusion of layouts/partial/paige/page.html in layouts/_default/single.html with its content,
then in that, replace the inclusion of layouts/partial/paige/page-header.html with its content,
then in that, change the page title.
By default, the content expands to fill the whole window.
This can result in very long lines, depending on the window width.
To use the recommended line length of 66 characters (40rem),
try the following in yoursite/hugo.toml:
By default, the content expands to fill the whole window.
This can result in very long lines, depending on the window width.
To use the recommended line length of 66 characters (40rem)
for all content except media,
try the following in yoursite/hugo.toml:
If you configure a menu, and intend for it to be sufficient for all navigation,
you should hide the breadcrumbs on every page,
and hide the collection, section, and page lists on the home page if you use the default home page layout.
To hide the breadcrumbs on every page,
try the following in yoursite/hugo.toml:
[params.paige.site]
disable_breadcrumbs = true
To hide the collection, section, and page lists on the home page,
try the following in yoursite/content/_index.md:
评论