我想创建一个直接发送到txt格式页面的页面,即路径如下:www.siteweb.fr/securite.txt
问题是,当我创建一个新的安全页面> _index.md时,我有这个前面的问题:
---
title: "Security"
featured_image: '...'
---
Text Text
这里我不能像用html()那样直接分配一个txt页面。
我尝试在前面的内容中添加“url”选项,但是当我这样做时,我有txt文件的路径,但页面上有一个XML格式。我不知道如何解决这个问题:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Sécurité on blog</title>
<link>http://192.168.x.x/fr/securite.txt</link>
<description>Recent content in Sécurité on blog</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="http://192.168.x.x/securite.txt" rel="self" type="application/rss+xml" />
</channel>
</rss>
下面是一个非常宽松/可行的定义,您应该检查文档,但它给出了一种理解:
但是,它构建什么,RSS、HTML、文本?
Hugo 用于构建的选项/参数之一是您的配置中的内容,例如:
page = ["HTML"]
home = ["HTML", "RSS", "JSON"]
section = ["HTML","RSS"]
这是我的配置,并指出我的页面 - 输出为 html。 主页输出为 HTML、RSS 和 JSON。 部分输出为 HTML 和 RSS。
现在这是全站范围。
因此,按照这个方向,请参阅下面的页面首页内容以进入特定页面:
---
date: "2016-03-19"
outputs:
- html
- txt
- json
---
如果您想查看文档: https://gohugo.io/variables/page/ https://gohugo.io/templates/output-formats/#customizing-output-formats
特别澄清的是: https://discourse.gohugo.io/t/custom-output-formats/33481/5 (如果你想变得更奇特的话)。