hugo-ivy icon indicating copy to clipboard operation
hugo-ivy copied to clipboard

关于博文链接在首页的显示问题

Open 4fee8fea opened this issue 3 years ago • 5 comments

hugo-ivy主题的首页中有下述一句话:

All pages not under the root directory of the website are listed below. You can also visit the list page of a single section, e.g., posts, or notes.

请问如何不显示首页的博文,而是在 /分类 或 /标签 中查阅博文呢?

4fee8fea avatar Apr 10 '21 14:04 4fee8fea

.IsHome 变量控制:https://github.com/yihui/hugo-ivy/blob/master/layouts/_default/list.html 时间精力所限,只能帮你到这儿了。

yihui avatar Apr 11 '21 02:04 yihui

谢谢!

https://bookdown.org/yihui/blogdown/templates.html#a-minimal-example

blogdown文档中记载了.IsHome的用法,或许查阅blogdown文档是我可以继续做下去的

4fee8fea avatar Apr 11 '21 03:04 4fee8fea

image image

yihui大大,我观察到如下现象:

如图,menu中指定的url: "/en/about/"实则指向的是content文件夹中的en-about.md文件

请问如何指向某文件夹下的子文件夹呢? (即:content文件夹下有名为subdir的子文件夹,如何在url中以形如"subdir"的方式指定呢)


另外我发现当指定某文件夹,意在显示其中的全部内容而不指定_index.md时,title位置会以s结尾...

4fee8fea avatar Apr 23 '21 16:04 4fee8fea

menu中指定的url: "/en/about/"实则指向的是content文件夹中的en-about.md文件

因为我自定义链接了:https://github.com/yihui/yihui.org/blob/master/content/en-about.md?plain=1#L3

请问如何指向某文件夹下的子文件夹呢?

我不太明白这个问题。子文件夹的链接是什么,这里就填什么。

若有后续问题,我建议你去论坛提问,如 https://d.cosx.org 或 Hugo 论坛 https://discourse.gohugo.io。我个人实在精力有限,无法当私人顾问。请谅解。

yihui avatar Apr 23 '21 18:04 yihui

修改 themes/hugo-ivy/layouts/_default/ 路径下的 list.html 文件,代码如下:

{{ partial "header.html" . }}

{{ .Content }}

{{ if not .IsHome }}
<ul>
  {{ range (where .Pages "Section" "!=" "") }}
  <li>
    <span class="date">{{ .Date.Format "2006/01/02" }}</span>
    <a href="{{ .RelPermalink }}">{{ .Title }}</a>
  </li>
  {{ end }}
</ul>
{{ end }}

{{ partial "footer.html" . }}

chuxinyuan avatar Oct 16 '23 04:10 chuxinyuan