{"id":23151003,"url":"https://github.com/coatless-quarto/adsense","last_synced_at":"2025-05-08T02:35:28.331Z","repository":{"id":206304517,"uuid":"716311948","full_name":"coatless-quarto/adsense","owner":"coatless-quarto","description":"A Quarto Extension to Enable Google Adsense on Quarto HTML Documents","archived":false,"fork":false,"pushed_at":"2025-03-22T04:23:07.000Z","size":421,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T16:33:55.369Z","etag":null,"topics":["adsense","google-adsense","lua","quarto","quarto-extension"],"latest_commit_sha":null,"homepage":"http://quarto.thecoatlessprofessor.com/adsense/","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coatless-quarto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["coatless"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-11-08T21:49:29.000Z","updated_at":"2025-03-29T11:33:09.000Z","dependencies_parsed_at":"2023-11-11T11:23:14.221Z","dependency_job_id":"4fcaf820-0465-46cc-bf90-c50e65d019aa","html_url":"https://github.com/coatless-quarto/adsense","commit_stats":null,"previous_names":["coatless-quarto/adsense"],"tags_count":2,"template":false,"template_full_name":"coatless-devcontainer/quarto-extension-dev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fadsense","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fadsense/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fadsense/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fadsense/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coatless-quarto","download_url":"https://codeload.github.com/coatless-quarto/adsense/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252987321,"owners_count":21836334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adsense","google-adsense","lua","quarto","quarto-extension"],"created_at":"2024-12-17T18:19:46.687Z","updated_at":"2025-05-08T02:35:28.312Z","avatar_url":"https://github.com/coatless-quarto.png","language":"Lua","readme":"# quarto-adsense: A Quarto Extension for Google Adsense\n\nThe `adsense` extension allows you to incorporate [Google Adsense (GADS)](https://adsense.google.com/start/) ad's on various [Quarto](https://quarto.org/) formats, including [HTML](https://quarto.org/docs/output-formats/html-basics.html), [Websites](https://quarto.org/docs/websites/), and [Books](https://quarto.org/docs/books). \n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/coatless-quarto/adsense)\n\nThis extension is required as [Quarto does **not** natively support Google Adsense](https://github.com/quarto-dev/quarto-cli/discussions/2898#discussioncomment-3905621), but [does have support for Google Analytics](https://quarto.org/docs/websites/website-tools.html#google-analytics).\n\n## Installation\n\nTo install the `adsense` extension, follow these steps:\n\n1. Open your terminal.\n\n2. Execute the following command:\n\n```bash\nquarto add coatless-quarto/adsense\n```\n\nThis command will download and install the extension under the `_extensions` subdirectory of your Quarto project. If you are using version control, ensure that you include this directory in your repository.\n\n## Usage\n\nThere are two modes available for the extension: \n\n1. A global configuration that allows a consistent option to be set for multiple pages with an option to opt a page out.\n2. A localized single page configuration.\n\n**Note:** Ads may take up to an hour to appear on the page/project.\n\n### Multi-page Projects: Websites and Books\n\nIf you have a website or book, you can use either the [`_quarto.yml`](https://quarto.org/docs/projects/quarto-projects.html#project-metadata) or [`_metadata.yml`](https://quarto.org/docs/projects/quarto-projects.html#directory-metadata) files to avoid needing to consistently set the value. Add into the configuration file: \n\n```yml\nadsense:\n  publisher-id: ca-pub-XXXXXXXXXXXXXXXX\n\nfilters:\n- adsense\n```\n\nwhere `XXXXXXXXXXXXXXXX` in `publisher-id` is your Google Adsense [Publisher ID](https://support.google.com/adsense/answer/105516?hl=en).\n\nIf you wish to disable ads on a specific page, then add to the Quarto document's YAML header area:\n\n```yml\nadsense:\n  enable-ads: false\n```\n\nFor more information, please see Quarto's documentation on [Shared Metadata](https://quarto.org/docs/projects/quarto-projects.html#shared-metadata).\n\n### Single Page Projects: HTML Document\n\nIf you only have one HTML document, we recommend setting up the extension by placing the required fields into the document's header section, e.g.\n\n```yml\n---\ntitle: \"Demo Setup\"\nauthor: \"FirstName LastName\"\nadsense:\n  publisher-id: ca-pub-XXXXXXXXXXXXXXXX\nfilters:\n- adsense\n---\n```\n\n### Google Adsense Setup: Adding `ads.txt`\n\nTo ensure smooth integration with Google Adsense, it's essential to create a [standalone file named `ads.txt`](https://support.google.com/adsense/answer/12171612) within your project directory that identifies the domain as being authorized to serve ads. Follow these steps to include the `ads.txt` file:\n\n1. **Create `ads.txt` File:**\n   In the root of your project, create a new file named `ads.txt`.\n\n2. **Add Google Publisher ID:**\n   Open `ads.txt` and insert the following line, replacing `XXXXXXXXXXXXXXXX` with your actual [Google Publisher ID](https://support.google.com/adsense/answer/105516?hl=en):\n\n   ```\n   google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0\n   ```\n\n   This line informs Google's web crawler about your association with the provided Publisher ID. For an example, please see the [`docs/ads.txt`](https://github.com/coatless-quarto/adsense/blob/main/README.md).\n\n3. **Save and Include in Version Control:**\n   Save the changes to `ads.txt` and ensure that the file is included in your version control system if you're using one.\n\n4. **Register `ads.txt` in _quarto.yml:**\n   Open the `_quarto.yml` configuration and add the `resources` line under the project key.\n\n   ```yaml\n   project:\n     type: website # default, book, revealjs\n     resources:\n       - ads.txt \n   ```\n\n   This ensures the additional file resources are copied to the output directory. \n\nThis step is crucial for validating your ownership of the website and enabling a smooth interaction between your Quarto-generated content and Google Adsense. Remember to replace `XXXXXXXXXXXXXXXX` with your specific Google Publisher ID.\n\n## References\n\n- Google Adsense\n    - [Google Adsense: Find Publisher ID](https://support.google.com/adsense/answer/105516?hl=en)\n    - [Google Adsense: Ads.txt guide](https://support.google.com/adsense/answer/12171612)\n    - [Google Adsense: Get and copy the AdSense code](https://support.google.com/adsense/answer/9274019?hl=en)\n    - [Google Adsense: Where to place the AdSense code in your HTML](https://support.google.com/adsense/answer/9274516?sjid=14850419192472362507-NC)\n- Quarto\n    - [Quarto: Lua API Reference](https://quarto.org/docs/extensions/lua-api.html)\n    - [Quarto: Lua Development](https://quarto.org/docs/extensions/lua.html)\n- Pandoc\n    - [Pandoc: Lua Filters](https://pandoc.org/lua-filters.html)\n    - [Pandoc: Lua type reference](https://pandoc.org/lua-filters.html#lua-type-reference)\n    - [Lua: Manual](https://www.lua.org/manual/5.4/)\n\n## Disclaimer\n\nThis Quarto extension is open source software and is **not affiliated with** Google. The extension is at best a community effort to simplify the integration of Google's Adsense product inside of Quarto websites.\n","funding_links":["https://github.com/sponsors/coatless"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-quarto%2Fadsense","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoatless-quarto%2Fadsense","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-quarto%2Fadsense/lists"}