What is the {block:Hidden} and when is it used?

2019-03-29 17:09发布

问题:

    {block:Hidden}
    <meta name="if:Sliding header" content="1">    
    <meta name="if:Collapse navigation" content="1">
    <meta name="if:Endless scrolling" content="1">

    <meta name="select:Layout" content="regular" title="Regular">
    <meta name="select:Layout" content="narrow" title="Narrow">
    <meta name="select:Layout" content="grid" title="Grid">

    <meta name="text:Disqus shortname" content="">
    <meta name="text:Google analytics ID" content="">
    {/block:Hidden}

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes">

This may seem like an obvious question, but I'm a beginning web designer that is trying to learn web design on my own. I know that these "blocks" are Tumblr specific, but don't know why {block:Hidden} is needed here. I was under the assumption that these meta ifs and names would already be hidden. And why aren't the two lines after {/block:Hidden} in the Hidden block?

回答1:

Meta tags are not rendered by the browser, like every other tag in <head>. They are there but "invisible" to the user. Some are read by the browser, some are read by search engines and in this case some are read by Tumblr.

Since Tumblr's meta tags (or theme options) are usually not needed outside Tumblr itself, you can use {block:Hidden} to prevent them from appearing in the generated HTML, thus saving bandwidth.

{block:Hidden} is not in the docs because it does not exist. For that reason, Tumblr never shows its content. {block:NOPE} or any other non-existent block would work the same way.


The meta tags outside that block are not Tumblr-related; They need to appear in the generated code and thus to be sent to the browser. Here's an article if you want to know more about the viewport meta tag.



回答2:

Content in between the block {block:Hidden} will not be rendered on the client / source.

Those meta tags are for defining variables that are used within the theme. They will be rendered by Tumblr but won't appear in the client / source code.

A still helpful resource for blocks: http://www.tumblr.com/docs/en/custom_themes



标签: tumblr hidden