complement
少于1分钟
将以下英文翻译为中文:
complement
https://gohugo.io/functions/complement/
Returns the elements of the last collection that are not in any of the others.
语法
complement COLLECTION [COLLECTION]...
collections.Complement COLLECTION [COLLECTION]...
To find the elements within $c3 that do not exist in $c1 or $c2:
| |
Make your code simpler to understand by using a chained pipeline:
| |
You can also use the complement function with page collections. Let’s say your site has five content types:
| |
To list everything except blog articles (blog) and frequently asked questions (faqs):
| |
Although the example above demonstrates the complement function, you could use the where function as well:
| |
In this example we use the complement function to remove stop words from a sentence:
| |
另请参阅
最后修改 June 1, 2023: 新增一个配置参数:sidebar_menu_truncate = 500 用于解决菜单不全的问题 (27810f1)