Skip to content

Instantly share code, notes, and snippets.

View candidexmedia's full-sized avatar
🤙
Creating a platform for open source content creation

candide ꘎ media candidexmedia

🤙
Creating a platform for open source content creation
View GitHub Profile
@candidexmedia
candidexmedia / 1 - Adding Custom HTML Tags in the Publii Toolbar.md
Last active March 15, 2024 12:23
Experiments in Publii TinyMCE WYSIWYG Editor Extensions (customElementsMode, Formats, Blocks, Templates)

Custom HTML Elements (via customElementsMode)

Custom Elements allow you to wrap selected text in the editor with the HTML tag and CSS class (optionally) of your choice <element>like this</element>. These wrappers can be given custom names and grouped in subfolders.

demo

A huge thanks to @b0fh for guidance on this in the forum and GH discussion.

Instructions

Deploy the new NocoDB template

  1. Go to the dashboard

  2. Click New Project

  3. Click Deploy a template

  4. Search for NocoDB

@candidexmedia
candidexmedia / update-date-publii.md
Last active July 18, 2023 02:06
[Publii] Post Modification Date – Manual Editing
@candidexmedia
candidexmedia / Publii-Simple-Mods.md
Last active April 26, 2023 20:45
Publii - Simple Fix for longer text descriptions in the hero

Here's a 2nd fix for the forum topic Need Help with Publii Glitches in Author and Tag Descriptions, which uses the Simple theme. Demo of issue: video

I'm assuming you're editing the main.css file in a theme override. If you're using "Custom CSS" inside Publii, try to override every rule that has to be deleted using "unset" (ex: .hero { position: unset; })

.hero Class

Delete or comment out the following three lines inside the .hero rule:

.hero {
  height: var(--hero-height); /*delete this line*/
@candidexmedia
candidexmedia / Masonry-Photoswipe-Publii.md
Last active February 26, 2024 23:37
Publii - Photoswipe Masonry

This is an explanation of how to achieve a Masonry gallery effect for Photoswipe galleries in Publii, in response to the forum post "Why a masonry layout for front pages, e.g. Mercury, but not for the galleries ?"

Credit: Yaroslav Khvorostyanenko - "Masonry gallery for Publii static CMS" and https://koolkat.photography/

Instructions

Go to your site folder > input > themes > [theme name] > css and edit the main.css file in the text editor of your choice.

Comment out (/*like this*/) or delete all the lines of code related to the gallery. These lines should be near the end of the file, around line 2,312. Next, paste the following code:

@candidexmedia
candidexmedia / 1 - HTML script.md
Last active September 19, 2023 03:32
Publii-Google-Translate-Widget-HTML.md

UPDATE: This method seems to be working again. If it ever stops working again, try GTranslate instead

Google Translate Widget Script

This is an English expansion of the Google Translate widget script covered in this video: https://www.youtube.com/watch?v=5meQKQhGBZg. Thank you to Programming with Vishal !

To get started, place this script in Tools & Plugins > Custom HTML > Footer:

Basic

@candidexmedia
candidexmedia / Publii-Google-Fonts-Self-Hosted.md
Last active December 22, 2023 03:33
Self-Host Google Fonts to Publii

(Code Snippets for: https://forum.getpublii.com/topic/where-should-the-font-files-be-put-if-self-host-google-fonts/#post-7040)

Update: it is now easier than ever to add custom fonts in Publii. See: How to Add a Custom Font (Publii Docs). You can still use the Google Webfonts Helper to download the woff2 files (or download directly from the Google Fonts, or the Font Foundry)

In terms of where to put the fonts: that's up to you. I've shared what I've done for my sites below.

In terms of referring: I would just use the Google Webfonts Helper to go faster: https://gwfh.mranftl.com/fonts. Just indicate which fonts you want, which weights, charset, where the files are located, etc. and it will format the code that you need to add at the top of your main.css file. This code will include the src.

@candidexmedia
candidexmedia / Publii-recipe-schema.md
Last active February 27, 2024 04:27
Publii-recipe-schema

Code snippets for: https://forum.getpublii.com/topic/looking-for-the-best-way-to-include-schema-markup/

Method 1: Custom Head + Post Template + Post Settings

  1. Create a theme override
  2. Duplicate the "head.hbs" partial and name it something new (ie "head-recipes.hbs")
  3. Create a custom post template that you'll use for recipes (ie "post-Recipes.hbs"). In this custom template, swap out the old {{> head}} for the new head partial {{> head-recipes}}
  4. Create a new version of "config.json" in your theme override. Edit this file, and add a custom post setting for this new template via the Theme Settings API (textarea type):