[ ← Back to list of links ]

How to include external text files on N.nu

This is the code that works both in the editor area and in the custom template area:

##INCLUDE=https://uploads.staticjw.com/ji/jim/include.txt,24##

The URL has to be a .txt file and the number means the amount of hours of cache.
Hard refresh (ctrl+r) can be used to bypass cache.
Minimum cache time is 4 hours, even if a lower number is specified.

The textfile can contain HTML or anything you want.
You can use custom backend code to automatically update your txt file with a cron and thus more easily display dynamic content.

Using Dropbox

Create a .txt file and share it using activate link that anyone can view. You get a link such as this one:
https://www.dropbox.com/s/wy5g45bahu4v78c/n.nu-include-test.txt?dl=0
Remove ?dl=0 from the end and replace www.dropbox with dl.dropboxusercontent and the URL becomes:
https://dl.dropboxusercontent.com/s/wy5g45bahu4v78c/n.nu-include-test.txt
That URL can be included in N.nu. This means that you can share a dropbox folder with other people that can help to edit content and when they save files the content becomes visible on the N.nu website(s).

Let's include it and see what happens:

##INCLUDE=https://dl.dropboxusercontent.com/s/wy5g45bahu4v78c/n.nu-include-test.txt,24##

This is a test file in my dropbox.

Using Github

Go to a public repo and click on a file ending with .txt. Click on the button Raw and you will come to a URL that start with https://raw.githubusercontent.com/ and ends with .txt which will also work to be included.

This means that you can have some content hosted in Github which your writers and editors has access to which enables you to have more control, version history and so forth.

Denna hemsida är byggd med N.nu - prova gratis du med.    (klicka här för att förlänga premium)(info & kontakt)