IluTov
IluTov

Reputation: 6852

Tumblr Themes - Custom Blocks

I'm creating a tumblr theme, and I'm completely new to it.

Now, I know that the user can configure his blog, like adding a title or a description which I can then display with {blocks}.

However I'd like the user to add his contact data, like the links to his social networks.

How does Tumblr usually handle this? Does the user have to edit the HTML?
This would mean that I have to hard-code this. Not very pleasing.

Or can I add customisable {blocks} somehow?

Upvotes: 4

Views: 1800

Answers (1)

freejosh
freejosh

Reputation: 11383

From the theme customization guide, it looks like you just have to include certain tags in the theme and they'll show up in the user's Customize panel.

By including the special meta-text tags in your theme, users can easily configure text variables you define. This is useful for adjusting text or configuring widgets that require information from the user.

Example

<html>
    <head>
        <!-- DEFAULT TEXT -->
        <meta name="text:Flickr Username" content=""/>
    </head>
    <body>
        {block:IfFlickrUsername}
            <div id="flickr_widget">
                <script type="text/javascript"
                src="http://flickr.com/widget?user={text:Flickr Username}">
                </script>
            </div>
        {/block:IfFlickrUsername}
    </body>
</html>

From the example above it looks like {text:Flickr Username} means that the user's customizable input field should be a text input and have the label "Flickr Username", then in the {block} tags you'd use the label without spaces as your variable name.

Upvotes: 6

Related Questions