0

The title might not make sense because I'm not sure what the correct wording is. But here is the example that explains what I mean.

I am creating a block view to go at the bottom of a node page that links in extra info relevant to the node (a users blog post on their profile page).

I titled the block Blog Posts but it was small and smashed up against the bottom of the content above it. So I tried calling it <h4>Blog Posts</h4> and it displayed as an <h4>. So I got more creative and now the title is <br><hr><h4>Blog Posts</h4>. It looks nice and works the way you would expect (with the html being rendered properly).

This method kind of seems like a bad hack, but inexperienced as I am with Drupal, I'm not sure why.

Is this bad practice, and why?

1
  • At least from an SEO point of view it's bad practice to use h-tags for anything other than continuous text. Use a div instead.
    – leymannx
    Apr 1, 2020 at 9:10

2 Answers 2

2

That'll work, but best practice is to theme it. The following answer describes how to theme a custom block: https://drupal.stackexchange.com/a/39270/23063

1

it is seriously bad practice... since you wrote markup in the title, it is stored in database. Storing unnecessary markups in database is BAD PRACTICE. That is why we have CSS for designing. Drupal also has jQuery which lets you change elements easily.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.