How can you add a template for a custom confirmation page URL? I want to show custom message on confirmation page (on custom URL). 
I created a custom URL in *.routing.yml file and added a method in controller class that returns an array :

return [
  '#theme' =&gt; 'mycustom_confirmation',
  '#test_var' =&gt; 'Test Value',
];


Next, in *.module file, 


I added hook_theme function to return below array:


    'mycustom_confirmation' =&gt; [     
          'variables' =&gt; ['mycustom_var' =&gt; NULL, 'webform' =&gt; NULL, 'source_entity' =&gt; NULL, 'webform_submission' =&gt; NULL],
        ]



I added template_preprocess_mycustom_confirmation function to add my customized variables.


Then I created a template file: mycustom-confirmation.html.twig file where I consume the customized variables to show custom message.

After all that, when I landed to confirmation URL (that I set in to admin/structure/webform/manage/webinar_training_request_1/settings/confirmation page) after webform submission , I dont see any message. I dont understand what I missed in module.
This would be a nice starting point:

/erlendsays.module

&lt;?php

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_form_alter().
 */
function erlendsays_form_alter(&amp;$form, FormStateInterface $form_state, $form_id) {
  array_unshift($form['actions']['submit']['#submit'], 'store_doublecheck_form_result');
}

function store_doublecheck_form_result(array $form, FormStateInterface $form_state) {
  Drupal::request()-&gt;getSession()-&gt;set("webform_result", $form_state-&gt;getValues());
}

/**
 * Implements hook_theme().
 */
function erlendsays_theme() {
  return [
    'doublecheck_form_result' =&gt; [
      'variables' =&gt; [
        'form_result' =&gt; NULL,
      ],
      'template' =&gt; 'doublecheck_form_result',
    ],
  ];
}


/erlendsays.routing.yml

erlendsays.doublecheck_form_result:
  path: '/doublecheckformresults'
  defaults:
    _controller: '\Drupal\erlendsays\Controller\DoublecheckFormResultController::index'
    _title: 'DoubleCheck Form results'
  requirements:
    _permission: 'access content'


/erlendsays/templates/doublecheck_form_result.html.twig

&lt;p&gt;TODO: print the form result.&lt;/p&gt;


/erlendsays/src/Controller/DoublecheckFormResultController.php

&lt;?php

namespace Drupal\erlendsays\Controller;

use Drupal\Core\Controller\ControllerBase;

class DoublecheckFormResultController extends ControllerBase {

  public function index() {
    return [
      '#theme' =&gt; 'doublecheck_form_result',
      '#form_result' =&gt; \Drupal::request()-&gt;getSession()-&gt;get("webform_result"),
    ];
  }

}