Skip to content

Instantly share code, notes, and snippets.

.container {
width: 500px;
border: 5px solid black;
display: flex;
item-align: stretch;
}
.item {
flex: 1 1 auto;
width: 100px;
}
.container {
width: 500px;
border: 5px solid black;
display: flex;
}
.item {
flex: 1 1 auto;
width: 100px;
height: 100px;
}
<div class="container">
<div class="item one"> </div>
<div class="item two"></div>
<div class="item three"></div>
<div class="item four"></div>
</div>
@enonicnorway
enonicnorway / controller.js
Last active August 29, 2015 14:23
getOpenGraphImage
function getOpenGraphImage( default_img ) {
var image_url = '';
// Find out if there are any images added to this content, and use it for Open Graph
if ( me.content.data.image || me.content.data.images ) {
var og_images;
var og_images_arr;
// Choose the correct attribute
if ( me.content.data.image ) {
@enonicnorway
enonicnorway / controller.js
Created June 29, 2015 13:55
getMetaDescription
function getMetaDescription() {
var moduleNamePropertyName = module.name.replace(/\./g,'-');
var metaDescription = '';
if (me.content.x[moduleNamePropertyName]) {
if (me.content.x[moduleNamePropertyName]['metadata']) {
if (me.content.x[moduleNamePropertyName]['metadata']['seo-preface']) {
metaDescription = me.content.x[moduleNamePropertyName]['metadata']['seo-preface'];
}
}
@enonicnorway
enonicnorway / controller.js
Created June 29, 2015 13:54
getPageTitle()
function getPageTitle() {
var moduleNamePropertyName = module.name.replace(/\./g,'-');
var metaTitle = '';
if (me.content.x[moduleNamePropertyName]) {
if (me.content.x[moduleNamePropertyName]['metadata']) {
if (me.content.x[moduleNamePropertyName]['metadata']['seo-title']) {
metaTitle = me.content.x[moduleNamePropertyName]['metadata']['seo-title'];
}
}
@enonicnorway
enonicnorway / controller.js
Last active August 29, 2015 14:23
Controller.js - Full
// INCLUDES
var UTIL = require('util/js/util'); // Default root path it looks in is "/cms/lib/" for all require-statements, also ".js" is the default file ending.
//var UTIL = require('/cms/lib/util/js/util.js'); // Same as above
// SETTINGS
var VIEW = 'default.html';
// Handle GET request
exports.get = handleGet;
@enonicnorway
enonicnorway / controller.js
Last active August 29, 2015 14:23
Controller.js - half
// INCLUDES
var UTIL = require('util/js/util'); // Default root path it looks in is "/cms/lib/" for all require-statements, also ".js" is the default file ending.
//var UTIL = require('/cms/lib/util/js/util.js'); // Same as above
// SETTINGS
var VIEW = 'default.html';
// Handle GET request
exports.get = handleGet;
@enonicnorway
enonicnorway / default.html
Last active August 29, 2015 14:23
Page Template view
<!DOCTYPE html>
<html lang="no">
<head>
<title data-th-text="${pageTitle}">Default Title</title>
<meta name="description" data-th-attr="content=${metaDescription}" content="Default Meta Description ..."/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta property="og:title" data-th-attr="content=${og.title}" />
<meta property="og:description" data-th-attr="content=${og.description}" />
<meta property="og:site_name" data-th-attr="content=${og.sitename}" />
@enonicnorway
enonicnorway / module.xml
Created June 29, 2015 13:40
/module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module>
<display-name>Your module name</display-name>
<info>Short explanation</info>
<url>http://enonic.com</url>
<vendor>
<name>Enonic AS</name>
<url>http://www.enonic.com</url>
</vendor>
<dependencies system-min-version="5.0.0" system-max-version="6.0.0"/>