mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 15:42:59 +00:00 
			
		
		
		
	Make default location for new tiddlers configurable
This commit is contained in:
		| @@ -1588,7 +1588,8 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) { | ||||
| 		$tw.wiki.addTiddlers(tiddlerFile.tiddlers); | ||||
| 	}); | ||||
| 	// Save the original tiddler file locations if requested | ||||
| 	if(wikiInfo.config && wikiInfo.config["retain-original-tiddler-path"]) { | ||||
| 	var config = wikiInfo.config || {}; | ||||
| 	if(config["retain-original-tiddler-path"]) { | ||||
| 		var output = []; | ||||
| 		for(var title in $tw.boot.files) { | ||||
| 			output.push(title + ": " + path.relative(resolvedWikiPath,$tw.boot.files[title].filepath) + "\n"); | ||||
| @@ -1596,7 +1597,7 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) { | ||||
| 		$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/x-tiddler-dictionary", text: output.join("")}); | ||||
| 	} | ||||
| 	// Save the path to the tiddlers folder for the filesystemadaptor | ||||
| 	$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddlersSubDir); | ||||
| 	$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir); | ||||
| 	// Load any plugins within the wiki folder | ||||
| 	var wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir); | ||||
| 	if(fs.existsSync(wikiPluginsPath)) { | ||||
|   | ||||
| @@ -11,5 +11,8 @@ | ||||
| 	], | ||||
| 	"includeWikis": [ | ||||
| 		"../tw5.com" | ||||
| 	] | ||||
| 	], | ||||
| 	"config": { | ||||
| 		"default-tiddler-location": "../tw5.com/tiddlers" | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| created: 20130825214200000 | ||||
| modified: 20140427210453175 | ||||
| modified: 20140720210453175 | ||||
| tags: dev | ||||
| title: TiddlyWikiFolders | ||||
| type: text/vnd.tiddlywiki | ||||
| @@ -29,6 +29,8 @@ The `tiddlywiki.info` file in a wiki folder contains a JSON object comprising th | ||||
|  | ||||
| Configuration options include: | ||||
|  | ||||
| * ''default-tiddler-location'' - a string path to the default location for the filesystem adaptor to save new tiddlers (resolved relative to the wiki folder) | ||||
|  | ||||
| * ''retain-original-tiddler-path'' - If true, the server will generate a tiddler [[$:/config/OriginalTiddlerPaths]] containing the original file paths of each tiddler in the wiki | ||||
|  | ||||
| For example: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jermolene
					Jermolene