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

增加文章列表块的请求 #2815

Open
2 tasks done
myeas opened this issue Feb 21, 2023 · 4 comments
Open
2 tasks done

增加文章列表块的请求 #2815

myeas opened this issue Feb 21, 2023 · 4 comments
Labels
contribution welcome PR about it is welcomed enhancement New feature or request

Comments

@myeas
Copy link

myeas commented Feb 21, 2023

Checklist

  • I searched existing issues and no one else requests similar feature.
  • I think that 25%+ users are positive towards this feature.

Describe the feature

您好,有如下想法,不知是否可考虑新增功能实现:
总体想法:增加文章列表块,以便在调用的页面(如首页、文章页等),都可以顺利调用;
比如很多主题中的首页中的最新文章就是我设想文章块中的一个例子。在此基础上,还可以实现如下更丰富的设定。

1)可以按参数设定几栏;比如2,则布局中是2个文章列表块并列显示。
2)可以按参数设定每栏(每个列表块)显示篇数可自定义;比如5,则每个文章块中显示为5个文章链接。
3)可以按参数设定每条显示多少字(避免影响整体布局);
4)可以按参数设定取指定分类/标签中的文章;这个最重要,比如参数分类为“前端”,则只取分类为前端的5篇文章链接形成列表。
5)可以按参数设定是取最新的,还是随机。比如文章页中,放置这么一个文章链接随机的列表块,以增加文章的曝光。
页面的效果类似该页:https://jeesite.com/docs/
(非本人网站,仅是供参考)

Additional context

No response

@myeas myeas added the enhancement New feature or request label Feb 21, 2023
@Mister-Hope
Copy link
Member

I am not sure I fully understand this, but it seems thay you want a customizable/random article list?

@myeas
Copy link
Author

myeas commented Feb 22, 2023

I am not sure I fully understand this, but it seems thay you want a customizable/random article list?

如下举例:
1、https://theme-hope.vuejs.press/zh/category/faq/ 该网址对应的标签是“FAQ”,对应的文章数量是6条。
2、我想把这5篇文章(具体数量以参数为准,比如5条、8条、10条等,假设参数是5条,则6条中只取前5条),放到首页某一区域的左侧;
3、https://theme-hope.vuejs.press/zh/category/%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B/ 该网址对应的标签是“快速上手”,对应的文章数量是11条。
4、我想把这5篇文章(前面2中参数是5条,因此这里取11条中的前5条),放到首页某一区域的右侧;
5、如下图的FAQ为一栏,快速上手为一栏。共两栏,分立左右。
image
6、
1)可以按参数设定几栏。如设置为2,则如图样式,如设置为3,则左中右。以此类推。
2)可以按参数设定每栏(每个列表块)显示篇数可自定义。比如5,则如图样式,如设置为8,则每栏的文章数量为8。
3)可以按参数设定每条显示多少字(避免影响整体布局)。
4)可以按参数设定取指定分类/标签中的文章。如图,FAQ栏中,取的内容自动是标签FAQ对应的文章;快速上手栏中,取的内容自动是标签快速上手对应的文章。
5)可以按参数设定是取最新的,还是随机。如图,FAQ栏中和速束上手都是取的最新的前5篇。则通过参数,这个“最新”,可以设置为“随机”。

@Mister-Hope Mister-Hope removed their assignment Feb 27, 2023
@Mister-Hope Mister-Hope added the contribution welcome PR about it is welcomed label Feb 28, 2023
@Mister-Hope
Copy link
Member

I am not very interested in this, as I think this might be related to custom layout. But I think that this idea is nice. Just leave this here.

PR welcomed if anyone build something.

@liub1934
Copy link
Contributor

useArticles可能对你有帮助,该方法可以获取到所有的文章列表,可以从中过滤出你想要的文章

import { useArticles } from '@theme-hope/modules/blog/composables/index'

const articles = useArticles()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome PR about it is welcomed enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants