Yes. My company's Theme scaffold does exactly this.
Here's the index.php file in our theme:
<?php
get_header();
get_template_part('template-parts/hero');
get_template_part('template-parts/main');
get_footer();
Hero conditionally loads a hero banner. If the client placed the hero banner block in the content, it does its thing. Main has logic remove that block if it exists so we don't render it twice. It has almost no markup:
<div class="container bodycontainer">
<?php if (!is_front_page() && !is_page('contact')) {
get_sidebar();
} ?>
<main id="main" tabindex="-1">
<?php if (get_post_type() == 'post') { ?>
<p class="meta"><?php // echo get_the_date('F j, Y'); ?> | by <?php //echo get_the_author_meta('display_name'); ?> </p>
<?php } ?>
<section id="content">
<?php
// all the context except hero banner block
$content_markup = '';
foreach ( $blocks as $block ) {
if ( 'acf/hero_banner' === $block['blockName'] ) {
continue;
} else {
$content_markup .= render_block( $block );
}
}
// Remove wpautop filter so we do not get paragraphs for two line breaks in the content.
$priority = has_filter( 'the_content', 'wpautop' );
if ( false !== $priority ) {
remove_filter( 'the_content', 'wpautop', $priority );
}
echo apply_filters( 'the_content', $content_markup );
if ( false !== $priority ) {
add_filter( 'the_content', 'wpautop', $priority );
}
?>
</section>
</main>
</div>