javascript Tumblr:创建自定义主页

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17091566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 07:03:26  来源:igfitidea点击:

Tumblr: Creating a Custom Home Page

javascripthtmltumblr

提问by Andrew.

I have been searching around for links that I thought could help me in designing a customized home page for my tumblr, without showing the posts unless a link refers to a tagged page or a permalink page. Unfortunately I have found nothing that works, at least in the sites I've been to. Could someone please assist me on how to make this work?

我一直在四处寻找我认为可以帮助我为我的 tumblr 设计定制主页的链接,除非链接指向标记页面或永久链接页面,否则不显示帖子。不幸的是,我没有发现任何有效的方法,至少在我去过的网站中是这样。有人可以帮助我如何完成这项工作吗?

Is there a certain code (like Javascript) that I have to insert? I'm pretty vague on Javascript except on CSS3 and HTML. Thanks in advance for answering!

是否有我必须插入的特定代码(如 Javascript)?除了 CSS3 和 HTML,我对 Javascript 非常模糊。预先感谢您的回答!

回答by mikedidthis

Seperate homepage / tagged / permalink pages

单独的主页/标记/永久链接页面

It is possible to have different content / visuals for the following pages:

以下页面可能有不同的内容/视觉效果:

  1. Homepage - http://you.tumblr.com
  2. Tagged Page - http://you.tumblr.com/tagged/yourtag
  3. Permalink Page - http://you.tumblr.com/post/123456/your-post-title
  1. 主页 - http://you.tumblr.com
  2. 标记页面 - http://you.tumblr.com/tagged/yourtag
  3. 永久链接页面 - http://you.tumblr.com/post/123456/your-post-title

{block: IndexPage}, {block:PermalinkPage}and {block:TagPage}are your friends.

{block: IndexPage}{block:PermalinkPage}并且{block:TagPage}是你的朋友。

Below is an example of a homepage with no posts, and the tagged / permalink containing posts.

下面是一个没有帖子的主页示例,以及包含帖子的标记/永久链接。

{block:IndexPage}
<h1>Homepage</h1>
<!-- Don't include Post loop here -->
{block:TagPage}
<h1>Tag Page</h1>
<!-- Include Post loop here -->
{block:Posts}
{block:Text} 
{block:Title}{Title}{/block:Title}
{Body}
{/block:Text}
{/block:Posts}
{/block:TagPage}
{/block:IndexPage}

{block:PermalinkPage}
<h1>Permalink Page</h1>
<!-- Include Post loop here -->
{block:Posts}
{block:Text} 
{block:Title}{Title}{/block:Title}
{Body}
{/block:Text}
{/block:Posts}
{/block:PermalinkPage}

Inside the Postsloop include what ever post types you need. More information can be found here: http://www.tumblr.com/docs/en/custom_themes#basic_variables& http://www.tumblr.com/docs/en/custom_themes#tag-pages

Posts循环内包括您需要的任何帖子类型。更多信息可以在这里找到:http: //www.tumblr.com/docs/en/custom_themes#basic_variables& http://www.tumblr.com/docs/en/custom_themes#tag-pages

回答by Seiyria

Well, you have three choices:

那么,你有三个选择:

  • Work within tumblr, and do your CSS/JS on there (though I believe it's very limited) through the "Customize" feature (or, you can get a theme that does what you want).
  • Route all of your tumblr posts through a custom domainname (so your blog shows up as a different domain name instead of yourblog.tumblr.com).
  • Make your own custom website, on your own custom webspace, and pull your blogs RSS feed (yourblog.tumblr.com/rss), and then format it however you want.
  • 在 tumblr 中工作,并通过“自定义”功能(或者,你可以获得一个可以做你想要的主题)在那里做你的 CSS/JS(虽然我认为它非常有限)。
  • 通过自定义域名路由您的所有 tumblr 帖子(因此您的博客显示为不同的域名,而不是 yourblog.tumblr.com)。
  • 在您自己的自定义网站空间上创建您自己的自定义网站,并提取您的博客 RSS 提要 (yourblog.tumblr.com/rss),然后根据需要对其进行格式化。