id,page,ref,title,content,breadcrumbs,references
internals:internals-datasette-urls,internals,internals-datasette-urls,datasette.urls,"The  datasette.urls  object contains methods for building URLs to pages within Datasette. Plugins should use this to link to pages, since these methods take into account any  base_url  configuration setting that might be in effect. 
                 
                     
                         datasette.urls.instance(format=None) 
                         
                             Returns the URL to the Datasette instance root page. This is usually  ""/"" . 
                         
                     
                     
                         datasette.urls.path(path, format=None) 
                         
                             Takes a path and returns the full path, taking  base_url  into account. 
                             For example,  datasette.urls.path(""-/logout"")  will return the path to the logout page, which will be  ""/-/logout""  by default or  /prefix-path/-/logout  if  base_url  is set to  /prefix-path/ 
                         
                     
                     
                         datasette.urls.logout() 
                         
                             Returns the URL to the logout page, usually  ""/-/logout"" 
                         
                     
                     
                         datasette.urls.static(path) 
                         
                             Returns the URL of one of Datasette's default static assets, for example  ""/-/static/app.css"" 
                         
                     
                     
                         datasette.urls.static_plugins(plugin_name, path) 
                         
                             Returns the URL of one of the static assets belonging to a plugin. 
                             datasette.urls.static_plugins(""datasette_cluster_map"", ""datasette-cluster-map.js"")  would return  ""/-/static-plugins/datasette_cluster_map/datasette-cluster-map.js"" 
                         
                     
                     
                         datasette.urls.static(path) 
                         
                             Returns the URL of one of Datasette's default static assets, for example  ""/-/static/app.css"" 
                         
                     
                     
                         datasette.urls.database(database_name, format=None) 
                         
                             Returns the URL to a database page, for example  ""/fixtures"" 
                         
                     
                     
                         datasette.urls.table(database_name, table_name, format=None) 
                         
                             Returns the URL to a table page, for example  ""/fixtures/facetable"" 
                         
                     
                     
                         datasette.urls.query(database_name, query_name, format=None) 
                         
                             Returns the URL to a query page, for example  ""/fixtures/pragma_cache_size"" 
                         
                     
                 
                 These functions can be accessed via the  {{ urls }}  object in Datasette templates, for example: 
                 Homepage
Fixtures database
facetable table
pragma_cache_size query 
                 Use the  format=""json""  (or  ""csv""  or other formats supported by plugins) arguments to get back URLs to the JSON representation. This is the path with  .json  added on the end. 
                 These methods each return a  datasette.utils.PrefixedUrlString  object, which is a subclass of the Python  str  type. This allows the logic that considers the  base_url  setting to detect if that prefix has already been applied to the path.","[""Internals for plugins"", ""Datasette class""]",[]