Page one
General
My name is Ryan Seymour and I will be 42 in a few weeks.
The current context is /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/page.one.md. The page title is Page one.
Section: hugo
The parent is /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/_index.md. You can chain `.Parent` values. For example:
- Parent of this page: /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/_index.md
- Grandparent of this page: /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/_index.md
- Great-grandparent of this page: /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/_index.md
- Great-great-grandparent of this page: There is not one, so it fails
Context
Page context
Shortcode context
$currentContext := .: {[] /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/page.one.md <nil> hugo-vals false 0 {{} {{} 0} {{} {0 0}}} {{} {{} 0} {{} {0 0}}} 194 { 0 0 0} <nil>}
$page := .Page: /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/page.one.md
range and with context
.Page.Title: hugo
one
two
three
map[test:1]
/home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/page.one.md - dogs
LOWERCASEEvens: 30
$odds: [1 3 5 7 9]
Seconds index: 5
$myMap: map[four:4 one:1 three:3 two:2]
$myMap.two: 2
Page: Pages(0)
Sidebar
Page: /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/page.one.md
Section: hugo
Regular pages: Pages(0)
Page methods
Page methods
Current page: /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/page.one.md
Ancestors
Lists all page ancestors, up to `content/_index
- /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/_index.md
- /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/_index.md
- /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/_index.md
You can create a breadcrumb with the .Reverse method:
Sections
CurrentSection is the section directory the topic is in. The section directory is identified by the _index.md file . For example, if the content file is in content > hugo > current, CurrentSection is current.
Section is the most top-level section under the content directory. If the content file is in content > hugo > current, Section is hugo.
- CurrentSection: /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/_index.md
- Section hugo
Eq
Lists all ancestors except the parent of the current page:
- /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/_index.md
- /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/_index.md
File
If a file is backed by a file (ex: generated by a .md file), then you can access values with .File.
File: page.one
Make sure the file is backed by a file with a "with .File" clause. This does not include top-level section pages, taxonomy pages, or term pages. This object gives you access to methods on the .File:
- BaseFileName: page.one
- ContentBaseName: page.one
- Dir (filepath): hugo/troubleshooting/
- Ext (extension): md
- Filename (abs path): /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/troubleshooting/page.one.md
- LogicalName (filename.ext): page.one.md
- Path (rel to /content dir): hugo/troubleshooting/page.one.md
- Section: hugo
- UniqueID (MD5 hash): a69c0e22052c388c48be0bc62a76a773
FirstSection
Returns the Page object for the top-level ancestor section. So if you are on page content > hugo > subdir > page, then this returns the Page object for hugo. This is different than Section, because .Section returns .Page.Section, a property of the Page object:
FirstSection: /home/runner/work/rjseymour66.github.io/rjseymour66.github.io/content/hugo/_index.md
Section: hugo
Fragments
Fragment of a URL, which represents a heading on the page. This only works for .Content generated with Hugo. For example, it will not work for a shortcode.
Headings can be nested. For example, if
- Headings (slice): [ { "ID": "", "Level": 0, "Title": "", "Headings": [ { "ID": "general", "Level": 2, "Title": "General", "Headings": null }, { "ID": "page-methods", "Level": 2, "Title": "Page methods", "Headings": null }, { "ID": "resource-methods", "Level": 2, "Title": "Resource methods", "Headings": null } ] } ]
- HeadingsMap (dict): { "general": { "ID": "general", "Level": 2, "Title": "General", "Headings": null }, "page-methods": { "ID": "page-methods", "Level": 2, "Title": "Page methods", "Headings": null }, "resource-methods": { "ID": "resource-methods", "Level": 2, "Title": "Resource methods", "Headings": null } }
- Identifiers (slice of id attrs of each heading): [ "general", "page-methods", "resource-methods" ]
The ToHTML returns a portion of the HTML returned by the TableOfContents. You can specify the start and end level, and then whether you want it as an ordered or unordered list.
Use this if you need control beyond what is available in the site config:
Word count tools
Fuzzy word count (rounded to nearest 100): 0
Word count (rounded to nearest 100): 0
GetPage
Both the Site and Page objects have the GetPage method. The Page method takes a path relative to the current page. The Site method returns a path relative to the content directory.
Use this in a with clause. For example, the following outputs "Creating a site", but you can output any page method:
hugoInSection
Returns a bool if the page is in the specified section. The section is the section Page object, not the Page object passed to the template. So, the dot (.) represents the section/_index.md file.
Use in a with clause so you can return nothing if it fails:
trueIsHome
IsHome: false
IsNode and IsPage
Returns true if the page is home, section (_index.md that is not home), taxonomy, or term page. False if the page kind is page:
IsNode: false
Similarly, IsPage returns true if the page is of kind page:
IsPage: true
Keywords
Loop through the keywords:
this is how to use keywords this, is, how, to, use, and keywordsKind
Returns a string of what kind of page it is:
Kind: page
LastMod: 2025-07-13 09:31:04 -0400 -0400
Layout (defined in frontmatter):
Len: 0
Prev and Next (uncomment in shortcode:)
Output formats
Pages
Returns a collection (array, slice, or map) of regular pages in the same section, and also the section pages (_index.md) for immediate descendants (sections directly below it).
This method works on both the .Site and .Page object:
Params
You can add custom params to a page's frontmatter. These values are stored in a map that you can access with the .Params method. The Site object also has a .Params method, so make sure you are using the same context.
Keys that contain a hyphen are not valid identifiers, so you have to access them with the index function. In the following examples, "key-value-pair" is accessed with index .Page.Params "key-value-pair":
is_this_true:
key-value-pair:
params.author:
Path
Get the file path, even if the file is not backed by a file:
Path: /hugo/troubleshooting/page.one
RawContent
Lets you get the raw content of a page, excluding frontmatter.
RawContent: ## General {{< hugo-vals >}} ## Page methods {{< page-methods >}} ## Resource methods {{< resource >}}
Ref
Returns the absolute URL.
Accepts an options map (dict) that consists of these values:
- path: path to target page. Use a leading slash to resolve from the site root.
- lang: optional, the language of the target page.
- outputFormat: optional, the output format of the target page.
If Hugo cannot resolve the path, it throws an error. You can handle this in the site config with these values:
- refLinksErrorLevel: set to 'warning' so Hugo doesn't throw an error when .Ref can't resolve.
- refLinksNotFoundURL: where hugo redirects bad .Ref links
Pass the options map as an argument to .Ref and it will construct the absolute URL:
.Ref: https://rjseymour66.github.io/hugo/create-site/
- create-site
RelRef
Returns a relative URL of the page. Accepts an options map:
.Ref: /hugo/create-site/
- create-site
RegularPages
Returns a collection of regular pages within the current section. This doesn't return the section page (_index.md) for any sections within the current section--it only returns pages. It will return regular pages in a /resources subdirectory as long as that subdirectory does not contain an _index.md file.
You can't call this method on a Page kind, it only works on these pages:
- home
- section
- taxonomy
- term
This returns all regular pages for the current section (if it is a section page):
When you call it on the Site object, it returns all regular pages for the site:
Active vs passive
Aggregates
Animations
Ansible
Architecture
ARIA attributes
Arrays
Arrays
Assets and Pipes
Asynchronous JS
Attributes
Backups
Basics
Basics
Benchmarking
Best practices
Best practices
Best practices
Box Model
Branching
Brash one-liners
Build tools
Buttons
Channels
Characters and actions
Child page
Cloud
Cobra
Cohesion and coherence
Colors
Commands reference
Commit history
Common commands
Common Features
Components
Compression
Concepts
Concepts
Concision
Concurrent pipeline
Configuration
Configuration
Configuration files
Configuration objects
Container orchestration
Container Queries
Containers
Content Sections
Continuous integration (CI)
Core commands
Creating a Site
Cruising the filesystem
CSV
Cyberops bash notes
Data Sources
Data structures
Data types
Databases
Date Time
Debugging
Dependency injection
Dictionaries and sets
Disasters
DML
Document flow
Document geometry and scrolling
Document structure
Document structure
Emmet
Emphasis
Error handling
Errors
Errors
Events
File Monitoring
Files
Files and directories
Files and directories
Filesystem
Filtering data
Firewalls
Flag Package
Flexbox
Forms
Forms
Forms
Functional programming
Functions
Functions
Functions
Fundamentals
Fundamentals
Goroutines
Gradients, shadows, and blends
Grid
Headings and sections
HTML
HTTP client
HTTP Servers
Idioms and language features
Images
Images
Input/output
Installation
Interfaces
Introducing the shell
Iterators (TODO)
Joins
JSON
Keyboard efficiency
Language features
Layers
Leveraging text files
Linking content
Lists
Location, navigation, and history
Logging
Logs
Loops
Managing Focus
Maps
Masks, shapes, and clipping
Menus and menu buttons
Metadata
Metrics
Migrations
Modular CSS
MySQL
MySQL
Navigating the filesystem
Navigation
Navigation
Network Services
Networking
Networks
Objects
Objects and organization
Page one
Page structure
Panics
Parent, children, and environments
Patterns
Patterns
Patterns
Performance
Playground
Positioning
Postgres
PostgreSQL
Preprocessor
Presenting tabular data
Processes
Processes and pipes
Producing, isolating, combining, and transforming text
Programming environment
Project Setup
Project structure
Project structure
Pythonic patterns
Quality docs
Querying
Rebasing
Refactoring UI
Regex
Remotes
Rerunning commands
Responsive Design
Revision TLDR;
Robot
Running commands
Sample CSS stylesheet
Schema
Scripting documents
Search
Secrets
Securing the server
Security
Semantic HTML
Sentence analysis
Setting up a production-ready Go application
Setup
Shape
Sharing files
Shell
Shell efficiency
Slices
Software packages
SQL
SQL package
SQLite
Static files
Storage
Storage
Stored procedures
Strings
Strings
Structs
Structuring packages and services
Styling content
Subqueries
Syntax
Syntax and selectors
System Calls
System events
System Resources
Tables
Tagging
Task Scheduling
TCP
Terraform
Testing
Testing
Testing CLI tools
Testing Servers and Services
Text and links
Text processing
The bash shell
Theme Switcher
Themes
Time savers
TLS
Todo list
Toggle buttons
Toggling content visibility
Tooling
Tooltips and toggletips
Traces
Transactions
Transforms
Transitions
Troubleshooting
Typography
UDP
Undoing changes
Unit testing
Units
UNIX Sockets
Users and groups
Views
vim
Virtualization
Web Servers
Websockets and Server-sent events
Window functions
Writing bash scripts
Writing Functions
RegularPagesRecursive
Same as RegularPages, but returns pages within all descendant sections, and you can't call it on the Site object.
RelPermalink
Returns the relative permalink for the page:
RelPermalink: /hugo/troubleshooting/page.one/
.Site.GetPage: nopPage
RelPermalink:
Resources (Page)
Resources returns a collection of page resources, which is a file within a page bundle. If there are no page resources, then it returns nil.
Use these methods:
- ByType: Returns resources of the specified media type (image, text, audio, etc.)
- Get: Returns a page resource from the specified path
- GetMatch: Returns the first page resource from paths that match the specified glob pattern. Accepts a path with wildcards.
- Match: Returns a collection of page resources from paths that match the specified glob pattern. Accepts a path with wildcards.
resources (global)
resources returns a collection of global resource. A global resource is a file within the /assets directory, or a subdirectory within /assets.
Section
Returns the top-level section for the page:
Section: hugo
You can use this in a where clause to build a page collection. FOr example, if you want to build a collection of pages in a specific section, use the where function and Site object:
where .Site.RegularPages "Section" "
EmmetARIA attributesDocument structureDocument structureMetadataPage structureToggle buttonsLinking contentRefactoring UISemantic HTMLTodo listButtonsHeadings and sectionsMenusAttributesStylesFocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
Document structureDocument structureMetadataPage structureToggle buttonsLinking contentRefactoring UISemantic HTMLTodo listButtonsHeadings and sectionsMenusAttributesStylesFocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
MetadataPage structureToggle buttonsLinking contentRefactoring UISemantic HTMLTodo listButtonsHeadings and sectionsMenusAttributesStylesFocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
Toggle buttonsLinking contentRefactoring UISemantic HTMLTodo listButtonsHeadings and sectionsMenusAttributesStylesFocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
Refactoring UISemantic HTMLTodo listButtonsHeadings and sectionsMenusAttributesStylesFocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
Todo listButtonsHeadings and sectionsMenusAttributesStylesFocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
Headings and sectionsMenusAttributesStylesFocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
AttributesStylesFocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
FocusText and linksTooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
TooltipsListsNavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
NavigationNavigationVisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
VisibilityFormsTablesFiltering dataFormsTablesDebuggingImagesSections
TablesFiltering dataFormsTablesDebuggingImagesSections
FormsTablesDebuggingImagesSections
DebuggingImagesSections
Sections
Reutrns a collection of section pages (_index.md) for the page object. This works only on these page types:
- home
- section
- taxonomy
Sections by weight on the Page:
Sections by weight on the Site object:
Writing
Linux
Bash
git
Python
Go
Javascript
CSS
Hugo
Web Development
Bash
SQL
Sites
Store
A map that you can store scratch data that is scoped to the current page. You can create a scratch pad in multiple scopes:
- page with PAGE.Store
- site with SITE.Store
- global with hugo.Store
- local with collections.NewScratch
- shortcode with SHORTCODE.Store
All scopes have these methods:
- Set: Sets a key value pair. Pass the k/v pair to the .Set method.
- Get: Gets the value of the given key.
- Add: Accepts an existing key and a value to append to the existing value.
- SetInMap: Creates a nested map. Accepts a key that is the map name, then a key and value that are added to that map.
- DeleteInMap: Takes the key and map key and removes the map key from the map.
- GetSortedMapValues:
TOC
Returns the level 2 and level 3 headings for a page. You can adjust this in the side config:
Resource methods
Many resource methods work with images.
Content
Returns the content of the resource, usually from the assets/ directory. You need to first use with and the .Get method to retrieve the resource, which also changes the context to that resource. Then, you can use .Content to work with the contents of the file.
This returns a template.HTML when it is a page, or it returns a string. Use this to get JS, CSS, image, and other pages.
Content:
52GetRemote
Data
The .Data method returns the body of an HTTP request. You send the HTTP request with resource.GetRemote.
It has these methods:
- ContentLength
- ContenType
- Headers
- Status
- StatusCode
- TransferEncoding
Err
Returns the error message if a resource.GetRemote HTTP request fails. By default, Hugo fails the build if the request returns an error. You can handle the error and fail the build with errorf. You can log the error as a warning with warnf rather than fail the build.
MediaType
Media type of the given resource. It has methods to return the type, main type, subtype, and more.
text/plainResourceType
Returns the main type of the resource's media type:
text textName
Returns the name of the resource or its file path as a fallback. If it is a page resource in a page bundle and you create an element in the resources array in the front matter, the Name method returns the value of the name parameter. Otherwise, it returns the filepath.
For remote resources, it returns a hashed file name.
/test/test.txtParams
Only works with page resources. Returns values defined in the resources.params front matter.
Permalink and RelPermalink
Returns and publishes the resource's permalink (absolute path) or relpermalink (relative path). It publishes the resource to the public/ directory with a hash:
https://rjseymour66.github.io/test/test.txtTitle
For a page resource, returns the title defined in the front matter. For a global resource, returns the relative path or hashed file name of the resource.
/test/test.txt