HUGO

  • Новости
  • Документация
  • Темы
  • Витрина
  • Сообщество
  • GitHub
  • Telegram
Star
FUNCTIONS

errorf and warnf

Log ERROR or WARNING from the templates.

Syntax

errorf FORMAT INPUT

errorf or warnf will evaluate a format string, then output the result to the ERROR or WARNING log (and only once per error message to avoid flooding the log).

Any ERROR will also cause the build to fail (the hugo command will exit -1).

Both functions return an empty string, so the messages are only printed to the console.

{{ errorf "Failed to handle page %q" .Path }}
{{ warnf "You should update the shortcodes in %q" .Path }}

Note that errorf and warnf support all the formatting verbs of the fmt package.

Смотрите также

  • float
  • dateFormat
  • emojify
  • htmlEscape
  • humanize
  • О Хьюго
    • Обзор
    • Модель безопасности Хьюго
    • Hugo и GDPR
    • Что такое Хьюго
    • Функции Хьюго
    • Преимущества статики
    • Лицензия
  • С чего начать
    • Обзор начала работы
    • Быстрый старт
    • Установка Хьюго
    • Основы использования
    • Структура каталогов
    • Настройка
    • Внешние ресурсы обучения
  • Модули Хьюго
    • Обзор модулей Hugo
    • Настройка модулей
    • Использование модулей Hugo
    • Компоненты темы
  • Управление контентом
    • Обзор управления контентом
    • Организация
    • Пакеты страниц
    • Форматы контента
    • Front Matter
    • Page Resources
    • Параметры сборки
    • Обработка изображений
    • Шорткоды
    • Связанный контент
    • Разделы
    • Типы контента
    • Архетипы
    • Таксономии
    • Содержание
    • Ссылки и перекрестные ссылки
    • Управление URL-адресами
    • Меню
    • Статические файлы
    • Комментарии
    • Многоязычный и i18n
    • Подсветка синтаксиса
  • Templates
    • Templates Overview
    • Introduction
    • Template Lookup Order
    • Custom Output Formats
    • Base Templates and Blocks
    • List Page Templates
    • Homepage Template
    • Section Templates
    • Taxonomy Templates
    • Single Page Templates
    • Content View Templates
    • Data Templates
    • Partial Templates
    • Shortcode Templates
    • Local File Templates
    • 404 Page
    • Menu Templates
    • Pagination
    • RSS Templates
    • Sitemap Template
    • Robots.txt
    • Internal Templates
    • Alternative Templating
    • Template Debugging
  • Functions
    • Functions Quick Reference
    • .AddDate
    • .Format
    • .Get
    • .GetPage
    • .HasMenuCurrent
    • .IsMenuCurrent
    • .Param
    • .Render
    • .RenderString
    • .Scratch
    • .Unix
    • absLangURL
    • absURL
    • after
    • anchorize
    • append
    • apply
    • base64
    • chomp
    • complement
    • cond
    • countrunes
    • countwords
    • dateFormat
    • default
    • delimit
    • dict
    • echoParam
    • emojify
    • eq
    • errorf and warnf
    • fileExists
    • findRE
    • first
    • float
    • ge
    • getenv
    • group
    • gt
    • hasPrefix
    • highlight
    • hmac
    • htmlEscape
    • htmlUnescape
    • hugo
    • humanize
    • i18n
    • Image Functions
    • in
    • index
    • int
    • intersect
    • isset
    • jsonify
    • lang.Merge
    • lang.NumFmt
    • last
    • le
    • len
    • lower
    • lt
    • markdownify
    • Math
    • md5
    • merge
    • ne
    • now
    • os.Stat
    • partialCached
    • path.Base
    • path.Dir
    • path.Ext
    • path.Join
    • path.Split
    • plainify
    • pluralize
    • print
    • printf
    • println
    • querify
    • range
    • readDir
    • readFile
    • ref
    • reflect.IsMap
    • reflect.IsSlice
    • relLangURL
    • relref
    • relURL
    • replace
    • replaceRE
    • safeCSS
    • safeHTML
    • safeHTMLAttr
    • safeJS
    • safeURL
    • seq
    • sha
    • shuffle
    • singularize
    • slice
    • slicestr
    • sort
    • split
    • string
    • strings.Count
    • strings.HasSuffix
    • strings.Repeat
    • strings.RuneCount
    • strings.TrimLeft
    • strings.TrimPrefix
    • strings.TrimRight
    • strings.TrimSuffix
    • substr
    • symdiff
    • templates.Exists
    • time
    • title
    • transform.Unmarshal
    • trim
    • truncate
    • union
    • uniq
    • upper
    • urlize
    • urls.Parse
    • where
    • with
  • Variables
    • Variables Overview
    • Site Variables
    • Page Variables
    • Shortcode Variables
    • Pages Methods
    • Taxonomy Variables
    • File Variables
    • Menu Entry Properties
    • Hugo Variables
    • Git Variables
    • Sitemap Variables
  • Hugo Pipes
    • Hugo Pipes Overview
    • Hugo Pipes Introduction
    • SASS / SCSS
    • PostProcess
    • PostCSS
    • JavaScript Building
    • Babel
    • Asset minification
    • Asset bundling
    • Fingerprinting and SRI
    • Resource from Template
    • Resource from String
  • CLI
  • Troubleshooting
    • Troubleshoot
    • FAQ
    • Build Performance
  • Tools
    • Developer Tools Overview
    • Migrations
    • Starter Kits
    • Frontends
    • Editor Plug-ins
    • Search
    • Other Projects
  • Hosting & Deployment
    • Hosting & Deployment Overview
    • Hugo Deploy
    • Host-Agnostic Deploys with Nanobox
    • Host on AWS Amplify
    • Host on Netlify
    • Host on Render
    • Host on Firebase
    • Host on GitHub
    • Host on GitLab
    • Hosting on KeyCDN
    • Host on Bitbucket
    • Deployment with Wercker
    • Deployment with Rsync
  • Contribute
    • Contribute to Hugo
    • Development
    • Documentation
    • Themes
  • Maintenance
“errorf and warnf” последнее обновление: December 24, 2020: Добавил папку для перевода RU (5edbf8359)
Улучшить эту страницу
Авторы Hugo
Hugo Logo
  • Подать вопрос
  • Получить помощь
  • Обсудить исходный код
  • @GoHugoIO
  • @spf13
  • @bepsays
 
 

Спонсоры Hugo

Logo for Forestry.io
Logo for Linode
Logo for eSolia
 

Авторские права на логотипы Hugo принадлежат © Steve Francia 2013–2021.

Hugo Gopher основан на оригинальной работе Renée French.

  • Новости
  • Документация
  • Темы
  • Витрина
  • Сообщество
  • GitHub
  • Telegram
  • О Хьюго
  • С чего начать
  • Модули Хьюго
  • Управление контентом
  • Templates
  • Functions
  • Variables
  • Hugo Pipes
  • CLI
  • Troubleshooting
  • Tools
  • Hosting & Deployment
  • Contribute
  • Maintenance