At some point near the end of development for my Drupal 8 site, any NEW block placed in a region isn't displaying or being output to the DOM. I place the block in a region, define what pages to display it on, click save blocks and yet nothing shows. I've tried clearing cache multiple times, but no dice.

All of my other blocks are still working (from before this started happening) but I'm afraid that if I remove them and try to re-add those blocks, they aren't going to render anymore. Any ideas?

Comments

XandieL’s picture

are using a custom theme?

did you try putting the block in the main content region?

I like the universe, but she messes with my words
I'm not talking planets or galaxies and the distance just makes it worse.
I know what you're thinking, this probably sounds rehearsed.

shaunmilo’s picture

Yes, I am using a custom theme and yes I've tried placing blocks in the main content region and other default Drupal regions, but they will not appear on the front end :(

XandieL’s picture

im not really sure, since i didnt explore theming yet

are you on the right theme tab?

did you try printing on the region template twigs files?

I like the universe, but she messes with my words
I'm not talking planets or galaxies and the distance just makes it worse.
I know what you're thinking, this probably sounds rehearsed.

shaunmilo’s picture

Yes, I'm using the right theme and I'm creating my regions in the "mytheme.info.yml" file and outputting them in page.html.twig

Jeff Burnz’s picture

Show us some code you are using, it could be a simple issue, also when you change a template you must clear the cache.

shaunmilo’s picture

I know, I've cleared the cache a million times.

Here's how I have my theme.info.yml file set up:

name: My Website
type: theme
description: Website theme
core: 8.x
libraries:
  - jrcts/global-styling
  - jrcts/rwdgrid
  - jrcts/cycle
  - jrcts/fancybox
  - jrcts/script
regions:
  top: Top
  header: Header
  nav: Navigation
  content_top: Content Top
  content: Content
  middle: Content Middle
  bottom: Content Bottom
  footer: Footer

Let's refer to the "Content Top" region for this example. In page.html.twig, I'm outputting the region like so:

<section>
    <div class="content-top">
      {{ page.content_top }}
    </div>
</section>

Then, I add a block with some content to the region in Block Layout. However, when I inspect the page, it gets output in the DOM as an empty div with no content:

  <section>
    <div class="content-top">
   
    </div>
  </section>
Jeff Burnz’s picture

That looks OK, what about region and block templates? What blocks are you enabling, are standard core blocks working, e.g branding etc?

I suppose I'm asking what you mean by "add a block with some content ".

Are you using a base theme (e.g. Classy?), if not do you have a block or region template in your theme? What do they look like?

shaunmilo’s picture

Standard core blocks also don't seem to display when placed in any region. By adding a block with some content, I mean that I'm simply creating a basic custom block with some dummy text in order to test.

I don't have a base theme defined and I'm not using any custom block or region templates with my theme. Just the default.

shaunmilo’s picture

However, the blocks are able to display when I switch to the Bartik theme... so there must be something strange happening with my custom theme.

Jeff Burnz’s picture

Zip your theme and put it somewhere we can download it, I'd need to debug it locally.

shaunmilo’s picture

So I actually managed to get my blocks/regions working again last night.

For some strange reason, once I switched to the Bartik theme (for debugging purposes) I moved my custom theme's page.html.twig file out of my templates/layout/ directory, cleared cache, moved the file BACK and then re-enabled my custom theme, things randomly started working again. Maybe there was some strange caching issue going on with the server? Who knows...

Kniekel’s picture

I have exactly the same problem, unfortunately on my live site.
The last thing I did was changing the responsive menu configuration of my main menu, then it disappeared.
The solution by shaunmilo doesn't work for me.
It's an AdaptiveTheme subtheme, so Jeff, maybe you can find something?
Even in Bartik, I can't add any blocks.
I still can rearrange blocks in the same region, though.
This is the site: www.mehrweggottesdienst.de

Jeff Burnz’s picture

What disappeared?

Really difficult to diagnose, I'd probably need access to the site etc, feel free to open an issue in the Adaptivetheme issue queue, perhaps we can get to the bottom of it.

Kniekel’s picture

Sorry, the menu disappeared.
Jeff, feel free to add yourself as a user on www.mehrweggottesdienst.de (unfortunately, the site is in German) - I'll change you to admin ASAP.
I'll open an issue, although I'm not totally sure this is an Adaptivetheme issue, since I can't add blocks in Bartik either.

Kniekel’s picture

Just in case anyone reads this thread: My problem was related to Rules and fixed in Drupal 8.2.1

airsplitter’s picture

Had the same issue, cost me about three days, finally found this thread and uninstalled rules module, what solved the issue.