Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
4fee8fea opened this issue Apr 10, 2021 · 5 comments
Open

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

4fee8fea opened this issue Apr 10, 2021 · 5 comments

Comments

@4fee8fea
Copy link

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 4fee8fea changed the title 关于首页博文的现实问题 关于首页博文的显示问题 Apr 10, 2021
@4fee8fea 4fee8fea changed the title 关于首页博文的显示问题 关于博文链接在首页的显示问题 Apr 10, 2021
@yihui
Copy link
Owner

yihui commented Apr 11, 2021

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

@4fee8fea
Copy link
Author

谢谢!

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

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

@4fee8fea
Copy link
Author

image
image

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

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

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


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

@yihui
Copy link
Owner

yihui commented Apr 23, 2021

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。我个人实在精力有限,无法当私人顾问。请谅解。

@chuxinyuan
Copy link
Contributor

chuxinyuan commented Oct 16, 2023

修改 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" . }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants