I have a drupal site where there are few cdn links attached. Now i was thinking of adding sri hash to those links. How can i do that. I am very new to drupal. I have tried but every solution tells to add custom module or hook function or something like that. But i don’t know how these things works.
But somehow i managed to create a custom module which creates a page in which there is written Hello. I just followed a tutorial. Can i add hash in it ?
sri.info.yml
name: SRI Hash type: module description: 'SRI Hash' package: custom version: 8.x core: 8.x
sri.routing.yml
sri.scripthash: path: '/sri_hash' defaults: _controller: 'DrupalsriControllerSriController::scripthash' _title: 'SRI Hash' requirements: _permission: 'access content'
SriController.php
<?php namespace DrupalsriController; class SriController { /** * Returns a simple page. * * @return array * A simple renderable array. */ public function scripthash() { $element = array( '#markup' => 'This is a page !', ); return $element; } } ?>
or, Is there any alternate way to do it ?