2017 © Pedro Peláez
 

drupal-module hyde

image

totten/hyde

  • Thursday, May 24, 2018
  • by totten
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Drupal is well and good, but I don't like editing pages in a web UI. Or storing them in MySQL. Or configuring workflows. Is that a problem? Can I still use Drupal?, (*1)

Mr. Hyde is the evil version of Dr. Jekyll -- it's a Drupal module that lets you create Markdown files and store them in a git repo... but it displays them as pages in a Drupal site. This allows you to use Drupal's general layout engine (themes and blocks) while tracking content in git (and using stock workflows like Github PR's or Gitlab MR's)., (*2)

Install the module

$ cd sites/all/modules
$ git clone https://github.com/totten/hyde
$ cd hyde
$ composer install
$ drush en hyde

Note: It should be OK to install via composer require totten/hyde, but I haven't done enough with D7+Composer to speak to that., (*3)

Initialize the content root

$ cd <drupal-private-data-folder>
$ mkdir hyde
$ cd hyde

Of course, this folder should probably be a git repo. You could initialize a new repo here (git init) or clone an existing repo., (*4)

Tip: If you want to store content in another folder, override the value of hyde_path by calling drush vset hyde_path /path/to/doc/root or editing settings.php., (*5)

Add a new page

$ echo "Hello __world__" > hello-world.md
$ drush cc all
$ curl https://example.org/hello-world
$ git add hello-world.md
$ git commit

Markdown metadata

In Jekyll syntax, a Markdown file can begin with a YAML metadata. In this example, we set the title of the HTML page with a little extra metadata:, (*6)

---
title: "The future of old school content"
---
# Old is the new new
Because sometimes you like to write content in a simple way.

# Git is the new CMS
Because sometimes you like to write content in a simple way.

Supported fields:, (*7)

  • title: The main HTML page title

Issues/Limitations/FIXMEs

There are several things that one might do if they really cared about this. Right now, I'm trying to write this quickly, so I don't really care., (*8)

  • Add an admin form for manging hyde_path
  • Test/implement page-cache support.
  • Rework as Drupal entity. If a file is writeable, allow editing the body via CLI or GUI. If a file is not writeable, then don't.
  • Add more options to the metadata for:
    • Setting permissions
    • Changing layouts
  • Want to be sure that only CLI users can manipulate Markdown files? Just set the file-permissions appropriately.

Coding style

This repo is a safe space for godawful code that I wrote in 15 minutes after drinking some beer., (*9)

The Versions

24/05 2018

dev-master

9999999-dev

  Sources   Download

GPL-2.0-or-later

The Requires

 

by Tim Otten