我知道有很多类似的问题,但到目前为止没有一个对我有用,请在标记为重复之前阅读该问题。
我使用 blogdown 包提供的 Rstudio 插件创建了一个网站,添加了两个带有类别的页面。类别的 rss 提要几乎正确生成,但我没有找到编辑模板的方法。对于“R”和“caaving”类别,rss 提要的标题是“Rs on ...”和“Cavings on ...”,这是没有意义的。我想将其更改为“R posts on ...”或“Posts in R on ...”或类似的内容。
我可以在配置中更改此设置还是需要编辑 rss 模板?
如果我需要编辑RSS模板:我把它们放在哪里,我累了
/layouts/rss.xml
,/layouts/categories.rss.xml
,/layouts/r/rss.xml
,它们都没有被正确拾取(当使用blogdown::serve_site()
服务网站时)。
文件夹结构如下所示:
content/
├── about.md
├── caving
│ └── 2024-01-27-example-caving-post
│ └── index.md
├── misc
├── R
│ └── 2024-01-27-adventures-in-shinylive
│ └── index.md
└── stats
R 中的帖子:
---
title: Adventures in Shinylive
author: Tobias Fellinger
date: '2024-01-27'
slug: adventures-in-shinylive
categories:
- R
tags:
- R
- shiny
- web-r
- shinylive
---
This will be a blogpost about porting a shiny app to shinylive.
探洞帖子:
---
title: example caving post
author: Tobias Fellinger
date: '2024-01-27'
slug: example-caving-post
categories:
- caving
tags:
- caving
---
this is a test
这是 config.yaml:
baseurl: /
languageCode: en-US
title: "Tobias Fellinger's Blog"
theme: hugo-lithium
googleAnalytics: ''
disqusShortname: ''
ignoreFiles:
- \.Rmd$
- \.Rmarkdown$
- _cache$
permalinks:
post: /:year/:month/:day/:slug/
menu:
main:
- name: About
url: /about/
- name: R
url: /r/
- name: Caving
url: /caving/
params:
MathJaxCDN: //cdnjs.cloudflare.com/ajax/libs
MathJaxVersion: 2.7.5
description: A website built through Hugo and blogdown.
favicon: favicon.ico
highlightjsCDN: //cdnjs.cloudflare.com/ajax/libs
highlightjsLang:
- r
- yaml
highlightjsTheme: github
highlightjsVersion: 9.12.0
logo:
alt: Logo
height: 50
url: logo.png
width: 50
markup:
defaultMarkdownHandler: goldmark
goldmark:
renderer:
unsafe: yes
highlight:
codeFences: no
除此之外,一切都是由
blogdown_1.18
创建的默认值。
要访问 rss feed,我使用了
blogdown::serve_site()
,然后访问了 http://localhost:4321/caving/index.xml
或 http://localhost:4321/r/index.xml
您的 RSS feed 模板应该位于
layouts/_defaults/rss.xml
中,如果不存在,只需创建该文件。
如果您想为每个类别创建不同的 rss feed,请为每个类别创建一个文件。例如,对于类别“r”,您可以创建
layouts/category/r.xml