Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

questions about formatting blog taglines #84

Open
edunham opened this issue Jan 18, 2015 · 1 comment
Open

questions about formatting blog taglines #84

edunham opened this issue Jan 18, 2015 · 1 comment
Assignees

Comments

@edunham
Copy link

edunham commented Jan 18, 2015

  1. Is it possible to get line breaks, bold/italic/underline, etc. in a blog's tagline by editing the tagline string in conf.py? I've tried using rst syntax, and also inserting raw html, and even thrown it the \n control character to see what would happen, but none of these attempts have worked.

  2. If it's currently impossible to get basic formatting in taglines, is this a feature that you'd like to have in Tinkerer eventually? As a Tinkerer user, I would personally like to have more flexibility in formatting my blog's tagline, but I understand that you as a developer might have some compelling reason why it would be problematic.

  3. If you would like tagline formatting to be implemented, would it be better to have the tagline string rendered from reStructuredText, or injected as raw HTML?

Thanks!

@vladris
Copy link
Owner

vladris commented Jan 18, 2015

Currently tagline string is passed directly to the templating engine and rendered as a string inside <h2> tags. Take a look at tinkerer/themes/boilerplate/layout.html. If you want a richer tagline, you can currently create a new _template/layout.html in your blog, have that inherit from the theme's layout.html, and override the header block.

You should have something like this in the _templates/layout.html of your blog:

{%- extends "!layout.html" -%}

{%- block header -%}
    <header role="banner">
        <hgroup>
            <h1><a href="{{ pathto(pages[0][0]) }}">{{ shorttitle|e }}</a></h1>
            --> Add whatever you like here <--
        </hgroup>
    </header>
{% endblock -%}

This is pretty much the header block from layout.html, with the tagline replaced by whatever you want to put in there. Tinkerer is doing something similar with the page.html template for the Tinkerer blog (at http://tinkerer.me). Take a look at /blog/_templates/page.html for this project.

I have to think a bit about what would be the best way to more easily enable this. reStructuredText might be trickier because of the way Sphinx works (though I guess we could go directly to docutils for this instead of Sphinx). Raw html might cause other issues, as it would bypass escaping which we get for free now from Jinja. If we would pass in raw html, taglines containing characters like <, > etc. would break the html.

I do agree with you that richer tagline should be easier to achieve, but I want to make sure it's done right. Hopefully the steps above will work for you, and I'll think some more about the best way this can be achieved.

@vladris vladris self-assigned this Jan 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants